Class: Bundler::LockfileParser

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/lockfile_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lockfile) ⇒ LockfileParser

Returns a new instance of LockfileParser.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/bundler/lockfile_parser.rb', line 7

def initialize(lockfile)
  @platforms    = []
  @sources      = []
  @dependencies = []
  @specs        = []
  @state        = :source

  lockfile.split(/(\r?\n)+/).each do |line|
    if line == "DEPENDENCIES"
      @state = :dependency
    elsif line == "PLATFORMS"
      @state = :platform
    else
      send("parse_#{@state}", line)
    end
  end
end

Instance Attribute Details

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



5
6
7
# File 'lib/bundler/lockfile_parser.rb', line 5

def dependencies
  @dependencies
end

#platformsObject (readonly)

Returns the value of attribute platforms.



5
6
7
# File 'lib/bundler/lockfile_parser.rb', line 5

def platforms
  @platforms
end

#sourcesObject (readonly)

Returns the value of attribute sources.



5
6
7
# File 'lib/bundler/lockfile_parser.rb', line 5

def sources
  @sources
end

#specsObject (readonly)

Returns the value of attribute specs.



5
6
7
# File 'lib/bundler/lockfile_parser.rb', line 5

def specs
  @specs
end