Class: Push2heroku::ConfigLoader
- Inherits:
-
Object
- Object
- Push2heroku::ConfigLoader
- Defined in:
- lib/push2heroku/config_loader.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#hash ⇒ Object
readonly
Returns the value of attribute hash.
Instance Method Summary collapse
-
#initialize(filename) ⇒ ConfigLoader
constructor
A new instance of ConfigLoader.
- #named_branches ⇒ Object
- #settings(branch_name) ⇒ Object
Constructor Details
#initialize(filename) ⇒ ConfigLoader
Returns a new instance of ConfigLoader.
6 7 8 9 |
# File 'lib/push2heroku/config_loader.rb', line 6 def initialize(filename) @filename = filename @hash = load_config end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
4 5 6 |
# File 'lib/push2heroku/config_loader.rb', line 4 def filename @filename end |
#hash ⇒ Object (readonly)
Returns the value of attribute hash.
4 5 6 |
# File 'lib/push2heroku/config_loader.rb', line 4 def hash @hash end |
Instance Method Details
#named_branches ⇒ Object
18 19 20 |
# File 'lib/push2heroku/config_loader.rb', line 18 def named_branches hash.keys - ['common'] end |
#settings(branch_name) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/push2heroku/config_loader.rb', line 11 def settings(branch_name) common_hash = hash['common'] || {} env_hash = hash[branch_name.to_s] || {} final_hash = common_hash.deep_merge(env_hash) Hashr.new(final_hash) end |