Class: Swappy::AppConfig
- Inherits:
-
Object
- Object
- Swappy::AppConfig
- Includes:
- Enumerable
- Defined in:
- lib/swappy/app_config.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #config_sets ⇒ Object
- #each(&block) ⇒ Object
- #each_config_set(&block) ⇒ Object
- #find_config_set_by_name(name) ⇒ Object
-
#initialize(options = {}) ⇒ AppConfig
constructor
A new instance of AppConfig.
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 = @path = [:path] end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/swappy/app_config.rb', line 5 def @options end |
#path ⇒ Object (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_sets ⇒ Object
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 |