Class: Musterb::RailsLocalsExtractor
- Inherits:
-
Object
- Object
- Musterb::RailsLocalsExtractor
- Defined in:
- lib/musterb/rails_locals_extractor.rb
Instance Attribute Summary collapse
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #[](symbol) ⇒ Object
-
#initialize(locals, binding, parent) ⇒ RailsLocalsExtractor
constructor
A new instance of RailsLocalsExtractor.
Constructor Details
#initialize(locals, binding, parent) ⇒ RailsLocalsExtractor
Returns a new instance of RailsLocalsExtractor.
4 5 6 7 8 |
# File 'lib/musterb/rails_locals_extractor.rb', line 4 def initialize(locals, binding, parent) @locals = locals @parent = parent @binding = binding end |
Instance Attribute Details
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
2 3 4 |
# File 'lib/musterb/rails_locals_extractor.rb', line 2 def parent @parent end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
2 3 4 |
# File 'lib/musterb/rails_locals_extractor.rb', line 2 def value @value end |
Instance Method Details
#[](symbol) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/musterb/rails_locals_extractor.rb', line 10 def [](symbol) if @locals.include? symbol @binding.eval symbol else parent[symbol] end end |