Class: Pessimize::GemfileLockVersionParser

Inherits:
Object
  • Object
show all
Defined in:
lib/pessimize/gemfile_lock_version_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGemfileLockVersionParser

Returns a new instance of GemfileLockVersionParser.



5
6
7
8
# File 'lib/pessimize/gemfile_lock_version_parser.rb', line 5

def initialize
  self.versions = {}
  self.parse_enabled = false
end

Instance Attribute Details

#versionsObject

Returns the value of attribute versions.



3
4
5
# File 'lib/pessimize/gemfile_lock_version_parser.rb', line 3

def versions
  @versions
end

Instance Method Details

#call(gemfile_lock_file) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/pessimize/gemfile_lock_version_parser.rb', line 10

def call(gemfile_lock_file)
  gemfile_lock_file.each_line do |line|
    if line.start_with? 'GEM'
      self.parse_enabled = true
    end
    if parse_enabled
      parse_line(line)
    end
  end
end