Parent

Methods

Files

Class/Module Index [+]

Quicksearch

Chef::VersionConstraint::Platform::VERSION_CLASS

Protected Instance Methods

parse(str="") click to toggle source
# File lib/chef/version/platform.rb, line 25
def parse(str="")
  @major, @minor, @patch =
    case str.to_s
    when /^(\d+)\.(\d+)\.(\d+)$/
      [ $1.to_i, $2.to_i, $3.to_i ]
    when /^(\d+)\.(\d+)$/
      [ $1.to_i, $2.to_i, 0 ]
    when /^(\d+)$/
      [ $1.to_i, 0, 0 ]
    when /^(\d+).(\d+)-[a-z]+\d?(-p(\d+))?$/   # Match FreeBSD
      [ $1.to_i, $2.to_i, ($4 ? $4.to_i : 0)]
    else
      msg = "'#{str.to_s}' does not match 'x.y.z', 'x.y' or 'x'"
      raise Chef::Exceptions::InvalidPlatformVersion.new( msg )
    end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.