Class: Greenenvy::Context
- Inherits:
-
Object
- Object
- Greenenvy::Context
- Defined in:
- lib/greenenvy/context.rb
Instance Method Summary collapse
-
#initialize(name_validator, env, code, container_class = OpenStructLike) ⇒ Context
constructor
A new instance of Context.
- #load_settings ⇒ Object
Constructor Details
#initialize(name_validator, env, code, container_class = OpenStructLike) ⇒ Context
Returns a new instance of Context.
3 4 5 6 7 8 |
# File 'lib/greenenvy/context.rb', line 3 def initialize(name_validator, env, code, container_class=OpenStructLike) @name_validator = name_validator @env = env @code = code @container_class = container_class end |
Instance Method Details
#load_settings ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/greenenvy/context.rb', line 10 def load_settings default_settings = {} env_settings = {} outer_context = OuterContext.new( @name_validator, @env, default_settings, env_settings, ) outer_context.instance_eval(@code) @container_class.new(default_settings.merge(env_settings)) end |