Class: InlineTesting::TestEnvironment::Locals
- Inherits:
-
Object
- Object
- InlineTesting::TestEnvironment::Locals
- Includes:
- MetaTools
- Defined in:
- lib/inline_testing/test_environment/locals.rb,
lib/inline_testing/test_environment/locals.rb
Defined Under Namespace
Classes: DSL
Instance Attribute Summary collapse
-
#locals ⇒ Object
readonly
Returns the value of attribute locals.
Instance Method Summary collapse
- #edit(&blk) ⇒ Object
-
#initialize ⇒ Locals
constructor
A new instance of Locals.
Constructor Details
#initialize ⇒ Locals
Returns a new instance of Locals.
36 |
# File 'lib/inline_testing/test_environment/locals.rb', line 36 def initialize; @locals = {}; end |
Instance Attribute Details
#locals ⇒ Object (readonly)
Returns the value of attribute locals.
34 35 36 |
# File 'lib/inline_testing/test_environment/locals.rb', line 34 def locals @locals end |
Instance Method Details
#edit(&blk) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/inline_testing/test_environment/locals.rb', line 38 def edit(&blk) new_locals = DSL.call(&blk) # Check for removed locals.. remove associated methods.. is this ever needed? hmm.. (@locals.keys - new_locals.keys).each { |local| .remove_method(local) } @locals = new_locals # Add/update methods @locals.each do |local, values| (local) { @locals[local][:obj] } unless .method_defined?(local) end self end |