Class: BBC::Cosmos::Tools::CosmosConfiguration
- Inherits:
-
Object
- Object
- BBC::Cosmos::Tools::CosmosConfiguration
- Defined in:
- lib/bbc/cosmos/tools/cosmos_configuration.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
- #component(id) ⇒ Object
- #component_keys ⇒ Object
- #cosmos_component(id) ⇒ Object
-
#initialize(config) ⇒ CosmosConfiguration
constructor
A new instance of CosmosConfiguration.
Constructor Details
#initialize(config) ⇒ CosmosConfiguration
Returns a new instance of CosmosConfiguration.
10 11 12 |
# File 'lib/bbc/cosmos/tools/cosmos_configuration.rb', line 10 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
8 9 10 |
# File 'lib/bbc/cosmos/tools/cosmos_configuration.rb', line 8 def config @config end |
Instance Method Details
#component(id) ⇒ Object
18 19 20 21 22 |
# File 'lib/bbc/cosmos/tools/cosmos_configuration.rb', line 18 def component(id) config.components[id].tap do |o| fail("Invalid component id: #{id}") if o.nil? end end |
#component_keys ⇒ Object
14 15 16 |
# File 'lib/bbc/cosmos/tools/cosmos_configuration.rb', line 14 def component_keys config.components.keys end |
#cosmos_component(id) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bbc/cosmos/tools/cosmos_configuration.rb', line 24 def cosmos_component(id) component(id).reduce([]) do |object, (key, value)| object.tap do |o| o << { :value => secure_key?(value) ? value["value"] : value, :key => key, :secure => secure_key?(value) } end end end |