Class: Stickler::GemfileLockParser

Inherits:
Object
  • Object
show all
Defined in:
lib/stickler/gemfile_lock_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ GemfileLockParser

Returns a new instance of GemfileLockParser.

Raises:



6
7
8
9
10
11
# File 'lib/stickler/gemfile_lock_parser.rb', line 6

def initialize( path )
  p = Pathname.new( path )
  raise Stickler::Error, "#{path} does not exist"  unless p.exist?
  raise Stickler::Error, "#{path} is not readable" unless p.readable?
  parse( p.read )
end

Instance Attribute Details

#gem_dependenciesObject (readonly)

Returns the value of attribute gem_dependencies.



3
4
5
# File 'lib/stickler/gemfile_lock_parser.rb', line 3

def gem_dependencies
  @gem_dependencies
end

Instance Method Details

#depends_on?(name) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/stickler/gemfile_lock_parser.rb', line 13

def depends_on?( name )
  gem_dependencies.any?{ |spec| spec.name == name }
end