123456789_123456789_123456789_123456789_123456789_

Class: Gem::RequestSet::Lockfile::Parser

Relationships & Source Files
Inherits: Object
Defined in: lib/rubygems/request_set/lockfile/parser.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(tokenizer, set, platforms, filename = nil) ⇒ Parser

Parses lockfiles

[ GitHub ]

  
# File 'lib/rubygems/request_set/lockfile/parser.rb', line 6

def initialize tokenizer, set, platforms, filename = nil
  @tokens    = tokenizer
  @filename  = filename
  @set       = set
  @platforms = platforms
end

Instance Method Details

#parse

[ GitHub ]

  
# File 'lib/rubygems/request_set/lockfile/parser.rb', line 13

def parse
  until @tokens.empty? do
    token = get

    case token.type
    when :section then
      @tokens.skip :newline

      case token.value
      when 'DEPENDENCIES' then
        parse_DEPENDENCIES
      when 'GIT' then
        parse_GIT
      when 'GEM' then
        parse_GEM
      when 'PATH' then
        parse_PATH
      when 'PLATFORMS' then
        parse_PLATFORMS
      else
        token = get until @tokens.empty? or peek.first == :section
      end
    else
      raise "BUG: unhandled token #{token.type} (#{token.value.inspect}) at line #{token.line} column #{token.column}"
    end
  end
end