Class: Heroku::Scalr::Config
- Inherits:
-
Object
- Object
- Heroku::Scalr::Config
- Defined in:
- lib/heroku/scalr/config.rb
Overview
Loads a config file and evaluates the stored configuration
Instance Attribute Summary collapse
-
#apps ⇒ Object
readonly
Returns the value of attribute apps.
Instance Method Summary collapse
- #app(name, opts = {}) ⇒ Object
- #defaults(opts = {}) ⇒ Object
-
#initialize(path) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(path) ⇒ Config
Returns a new instance of Config.
13 14 15 16 17 |
# File 'lib/heroku/scalr/config.rb', line 13 def initialize(path) @defaults = {} @apps = [] instance_eval File.read(path) end |
Instance Attribute Details
#apps ⇒ Object (readonly)
Returns the value of attribute apps.
10 11 12 |
# File 'lib/heroku/scalr/config.rb', line 10 def apps @apps end |
Instance Method Details
#app(name, opts = {}) ⇒ Object
28 29 30 31 |
# File 'lib/heroku/scalr/config.rb', line 28 def app(name, opts = {}) opts = @defaults.merge(opts) @apps << Heroku::Scalr::App.new(name, opts) end |
#defaults(opts = {}) ⇒ Object
21 22 23 |
# File 'lib/heroku/scalr/config.rb', line 21 def defaults(opts = {}) @defaults.update(opts) end |