Class: Blakey::Repository::Ruby::GemfileLockParser

Inherits:
Object
  • Object
show all
Defined in:
lib/blakey/repository/ruby/gemfile_lock_parser.rb

Constant Summary collapse

DEFAULT_GEMFILE_LOCK_PATH =
'Gemfile.lock'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gemfile_lock_path: nil, source:) ⇒ GemfileLockParser

Returns a new instance of GemfileLockParser.



8
9
10
11
# File 'lib/blakey/repository/ruby/gemfile_lock_parser.rb', line 8

def initialize(gemfile_lock_path: nil, source:)
  @gemfile_lock_path = (gemfile_lock_path || DEFAULT_GEMFILE_LOCK_PATH)
  @source            =  source
end

Instance Attribute Details

#gemfile_lock_pathObject (readonly)

Returns the value of attribute gemfile_lock_path.



13
14
15
# File 'lib/blakey/repository/ruby/gemfile_lock_parser.rb', line 13

def gemfile_lock_path
  @gemfile_lock_path
end

Instance Method Details

#dependenciesObject



15
16
17
# File 'lib/blakey/repository/ruby/gemfile_lock_parser.rb', line 15

def dependencies
  parsed_gemfile_lock.specs.map { |spec| [spec.name, spec.version.to_s] }.to_h
end

#ruby_versionObject



19
20
21
# File 'lib/blakey/repository/ruby/gemfile_lock_parser.rb', line 19

def ruby_version
  parsed_gemfile_lock.ruby_version
end