Class: Space::Model::Project::Bundler::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/space/model/project/bundler/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#configObject (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

#dataObject



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

#linesObject



12
13
14
# File 'lib/space/model/project/bundler/config.rb', line 12

def lines
  config.split("\n")[2..-1] || []
end

#to_hashObject



22
23
24
# File 'lib/space/model/project/bundler/config.rb', line 22

def to_hash
  Hash[*data]
end