# class 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 ]
        else
          msg = "'#{str.to_s}' does not match 'x.y.z', 'x.y' or 'x'"
          raise Chef::Exceptions::InvalidPlatformVersion.new( msg )
        end
    end