Class: Space::Model::Project::Bundler::Config
- Inherits:
-
Object
- Object
- Space::Model::Project::Bundler::Config
- Defined in:
- lib/space/model/project/bundler/config.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #data ⇒ Object
-
#initialize(config) ⇒ Config
constructor
A new instance of Config.
- #lines ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(config) ⇒ Config
Returns a new instance of Config.
8 9 10 |
# File 'lib/space/model/project/bundler/config.rb', line 8 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
6 7 8 |
# File 'lib/space/model/project/bundler/config.rb', line 6 def config @config end |
Instance Method Details
#data ⇒ Object
16 17 18 19 20 |
# File 'lib/space/model/project/bundler/config.rb', line 16 def data lines.map_slice(3) do |name, value, _| [name, value =~ /: "(.*)"/ && $1] end.compact.flatten end |
#lines ⇒ Object
12 13 14 |
# File 'lib/space/model/project/bundler/config.rb', line 12 def lines config.split("\n")[2..-1] || [] end |
#to_hash ⇒ Object
22 23 24 |
# File 'lib/space/model/project/bundler/config.rb', line 22 def to_hash Hash[*data] end |