Method: Gem::RequestSet::Lockfile::Parser#parse_dependency

Defined in:
lib/rubygems/request_set/lockfile/parser.rb

#parse_dependency(name, op) ⇒ Object

Parses the requirements following the dependency name and the op for the first token of the requirements and returns a Gem::Dependency object.



298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/rubygems/request_set/lockfile/parser.rb', line 298

def parse_dependency(name, op) # :nodoc:
  return Gem::Dependency.new name, op unless peek[0] == :text

  version = get(:text).value

  requirements = ["#{op} #{version}"]

  while peek.type == :comma do
    get :comma
    op      = get(:requirement).value
    version = get(:text).value

    requirements << "#{op} #{version}"
  end

  Gem::Dependency.new name, requirements
end