Class: Gemkeeper::ManifestReader
- Inherits:
-
Object
- Object
- Gemkeeper::ManifestReader
- Defined in:
- lib/gemkeeper/manifest_reader.rb
Constant Summary collapse
- DEFAULT_PATH =
File.("~/.config/gemkeeper/manifest.yml")
Instance Attribute Summary collapse
-
#gems ⇒ Object
readonly
Returns the value of attribute gems.
-
#source_url ⇒ Object
readonly
Returns the value of attribute source_url.
Class Method Summary collapse
Instance Method Summary collapse
- #find_by_name(name) ⇒ Object
- #gem_names ⇒ Object
-
#initialize(path) ⇒ ManifestReader
constructor
A new instance of ManifestReader.
Constructor Details
#initialize(path) ⇒ ManifestReader
Returns a new instance of ManifestReader.
15 16 17 18 19 20 |
# File 'lib/gemkeeper/manifest_reader.rb', line 15 def initialize(path) @path = path raise ManifestNotFoundError, unless File.exist?(@path) parse_manifest end |
Instance Attribute Details
#gems ⇒ Object (readonly)
Returns the value of attribute gems.
9 10 11 |
# File 'lib/gemkeeper/manifest_reader.rb', line 9 def gems @gems end |
#source_url ⇒ Object (readonly)
Returns the value of attribute source_url.
9 10 11 |
# File 'lib/gemkeeper/manifest_reader.rb', line 9 def source_url @source_url end |
Class Method Details
.load(path = DEFAULT_PATH) ⇒ Object
11 12 13 |
# File 'lib/gemkeeper/manifest_reader.rb', line 11 def self.load(path = DEFAULT_PATH) new(path) end |
Instance Method Details
#find_by_name(name) ⇒ Object
26 27 28 |
# File 'lib/gemkeeper/manifest_reader.rb', line 26 def find_by_name(name) @gems.find { |gem_entry| gem_entry[:name] == name } end |
#gem_names ⇒ Object
22 23 24 |
# File 'lib/gemkeeper/manifest_reader.rb', line 22 def gem_names @gems.map { |gem_entry| gem_entry[:name] } end |