Class: Pharrell::Environment
- Inherits:
-
Object
- Object
- Pharrell::Environment
- Defined in:
- lib/pharrell.rb
Instance Method Summary collapse
- #config(name, opts = {}, &blk) ⇒ Object
-
#initialize ⇒ Environment
constructor
A new instance of Environment.
- #instance_for(klass) ⇒ Object
- #rebuild! ⇒ Object
- #use_config(name) ⇒ Object
Constructor Details
#initialize ⇒ Environment
36 37 38 39 |
# File 'lib/pharrell.rb', line 36 def initialize @configs = {} @config = nil end |
Instance Method Details
#config(name, opts = {}, &blk) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/pharrell.rb', line 41 def config(name, opts = {}, &blk) ([:extends], opts) if opts[:extends] @configs[name] = fetch_config(opts[:extends]).extend(blk) else @configs[name] = Config.new(blk) end end |
#instance_for(klass) ⇒ Object
56 57 58 |
# File 'lib/pharrell.rb', line 56 def instance_for(klass) current_config.instance_for(klass) end |
#rebuild! ⇒ Object
60 61 62 |
# File 'lib/pharrell.rb', line 60 def rebuild! current_config.rebuild! end |
#use_config(name) ⇒ Object
51 52 53 54 |
# File 'lib/pharrell.rb', line 51 def use_config(name) @config = name rebuild! end |