diff options
author | nfagerlund <nick.fagerlund@gmail.com> | 2011-07-19 17:19:47 -0700 |
---|---|---|
committer | nfagerlund <nick.fagerlund@gmail.com> | 2011-08-09 15:56:45 -0700 |
commit | a110d83fb81bf35d2d4d66d1d04e271877b79948 (patch) | |
tree | abfeae03673609a945e6f9a12c59f39c199d09e9 /lib/puppet/parser/functions | |
parent | 6d1418ca7069816353356db960fbeee623451856 (diff) | |
download | puppet-a110d83fb81bf35d2d4d66d1d04e271877b79948.tar.gz puppet-a110d83fb81bf35d2d4d66d1d04e271877b79948.tar.xz puppet-a110d83fb81bf35d2d4d66d1d04e271877b79948.zip |
Maint: Fix poor documentation for versioncmp function.
The versioncmp function's documentation was missing punctuation and was
unnecessarily vague. This commit clarifies the return data and makes the
documentation more legible at a glance.
Diffstat (limited to 'lib/puppet/parser/functions')
-rw-r--r-- | lib/puppet/parser/functions/versioncmp.rb | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/puppet/parser/functions/versioncmp.rb b/lib/puppet/parser/functions/versioncmp.rb index 6091e0923..a06866876 100644 --- a/lib/puppet/parser/functions/versioncmp.rb +++ b/lib/puppet/parser/functions/versioncmp.rb @@ -4,19 +4,19 @@ require 'puppet/util/package' Puppet::Parser::Functions::newfunction( :versioncmp, :type => :rvalue, - :doc => "Compares two versions + :doc => "Compares two version numbers. Prototype: \$result = versioncmp(a, b) -Where a and b are arbitrary version strings +Where a and b are arbitrary version strings. -This functions returns a number: +This function returns: -* Greater than 0 if version a is greater than version b -* Equal to 0 if both version are equals -* Less than 0 if version a is less than version b +* `1` if version a is greater than version b +* `0` if the versions are equal +* `-1` if version a is less than version b Example: @@ -24,6 +24,9 @@ Example: notice('2.6-1 is > than 2.4.5') } +This function uses the same version comparison algorithm used by Puppet's +`package` type. + ") do |args| unless args.length == 2 |