Class: Greenenvy::OuterContext
- Inherits:
-
Object
- Object
- Greenenvy::OuterContext
- Defined in:
- lib/greenenvy/context.rb
Instance Method Summary collapse
- #default(&block) ⇒ Object
- #env(env_name, &block) ⇒ Object
-
#initialize(name_validator, env, default_settings, env_settings) ⇒ OuterContext
constructor
A new instance of OuterContext.
Constructor Details
#initialize(name_validator, env, default_settings, env_settings) ⇒ OuterContext
Returns a new instance of OuterContext.
27 28 29 30 31 32 |
# File 'lib/greenenvy/context.rb', line 27 def initialize(name_validator, env, default_settings, env_settings) @name_validator = name_validator @env = env @default_settings = default_settings @env_settings = env_settings end |
Instance Method Details
#default(&block) ⇒ Object
42 43 44 45 |
# File 'lib/greenenvy/context.rb', line 42 def default(&block) inner_context = InnerContext.new(@name_validator, @default_settings) inner_context.instance_eval(&block) end |
#env(env_name, &block) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/greenenvy/context.rb', line 34 def env(env_name, &block) if env_name.to_s == @env.to_s @name_validator.validate!(env_name) inner_context = InnerContext.new(@name_validator, @env_settings) inner_context.instance_eval(&block) end end |