Class: Whally::GemsExtractor
- Inherits:
-
Object
- Object
- Whally::GemsExtractor
- Defined in:
- lib/whally/gems_extractor.rb
Overview
Extract gems from a gemfile
Instance Attribute Summary collapse
-
#collect ⇒ Object
readonly
Returns the value of attribute collect.
Instance Method Summary collapse
- #gems ⇒ Object
-
#initialize(pathfile) ⇒ GemsExtractor
constructor
A new instance of GemsExtractor.
- #normalize_pathfile ⇒ Object
Constructor Details
#initialize(pathfile) ⇒ GemsExtractor
Returns a new instance of GemsExtractor.
6 7 8 9 10 11 |
# File 'lib/whally/gems_extractor.rb', line 6 def initialize(pathfile) @pathfile = pathfile @collect = [] gems end |
Instance Attribute Details
#collect ⇒ Object (readonly)
Returns the value of attribute collect.
4 5 6 |
# File 'lib/whally/gems_extractor.rb', line 4 def collect @collect end |
Instance Method Details
#gems ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/whally/gems_extractor.rb', line 13 def gems normalize_pathfile file = File.open(@pathfile, 'r') file.each_line do |line| @collect << Whally::Gemline.new(line).to_gem end end |
#normalize_pathfile ⇒ Object
23 24 25 |
# File 'lib/whally/gems_extractor.rb', line 23 def normalize_pathfile @pathfile += '/Gemfile' unless @pathfile.include? 'Gemfile' end |