Class: Swappy::AppConfig

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/swappy/app_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ AppConfig

Returns a new instance of AppConfig.



7
8
9
10
# File 'lib/swappy/app_config.rb', line 7

def initialize(options={})
  @options = options
  @path = options[:path]
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/swappy/app_config.rb', line 5

def options
  @options
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/swappy/app_config.rb', line 5

def path
  @path
end

Instance Method Details

#config_setsObject



12
13
14
# File 'lib/swappy/app_config.rb', line 12

def config_sets
  @config_sets ||= json_config_sets.map { |config_set| ConfigSet.new(config_set) }
end

#each(&block) ⇒ Object



16
17
18
# File 'lib/swappy/app_config.rb', line 16

def each(&block)
  each_config_set(&block)
end

#each_config_set(&block) ⇒ Object



20
21
22
23
24
# File 'lib/swappy/app_config.rb', line 20

def each_config_set(&block)
  config_sets.each do |config_set|
    block.call(config_set)
  end
end

#find_config_set_by_name(name) ⇒ Object



26
27
28
# File 'lib/swappy/app_config.rb', line 26

def find_config_set_by_name(name)
  config_sets.find { |set| set.name == name }
end