Class: Reviewer::Setup::GemfileLock
- Inherits:
-
Object
- Object
- Reviewer::Setup::GemfileLock
- Defined in:
- lib/reviewer/setup/gemfile_lock.rb
Overview
Parses a Gemfile.lock to extract gem names from the specs section
Constant Summary collapse
- SPEC_LINE =
Spec lines are indented with 4 spaces: “ gem-name (version)”
/\A {4}(\S+)\s/
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#gem_names ⇒ Set<String>
Returns the set of gem names found in the specs section.
-
#initialize(path) ⇒ GemfileLock
constructor
Creates a parser for extracting gem names from a Gemfile.lock.
Constructor Details
#initialize(path) ⇒ GemfileLock
Creates a parser for extracting gem names from a Gemfile.lock
16 17 18 |
# File 'lib/reviewer/setup/gemfile_lock.rb', line 16 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
10 11 12 |
# File 'lib/reviewer/setup/gemfile_lock.rb', line 10 def path @path end |
Instance Method Details
#gem_names ⇒ Set<String>
Returns the set of gem names found in the specs section
23 24 25 26 27 |
# File 'lib/reviewer/setup/gemfile_lock.rb', line 23 def gem_names return Set.new unless path.exist? parse_specs end |