Class: Stickler::GemfileLockParser
- Inherits:
-
Object
- Object
- Stickler::GemfileLockParser
- Defined in:
- lib/stickler/gemfile_lock_parser.rb
Instance Attribute Summary collapse
-
#gem_dependencies ⇒ Object
readonly
Returns the value of attribute gem_dependencies.
Instance Method Summary collapse
- #depends_on?(name) ⇒ Boolean
-
#initialize(path) ⇒ GemfileLockParser
constructor
A new instance of GemfileLockParser.
Constructor Details
#initialize(path) ⇒ GemfileLockParser
Returns a new instance of GemfileLockParser.
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_dependencies ⇒ Object (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
13 14 15 |
# File 'lib/stickler/gemfile_lock_parser.rb', line 13 def depends_on?( name ) gem_dependencies.any?{ |spec| spec.name == name } end |