Class: RubyReactor::Template::Element
- Defined in:
- lib/ruby_reactor/template/element.rb
Instance Attribute Summary collapse
-
#map_name ⇒ Object
readonly
Returns the value of attribute map_name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(map_name, path = nil) ⇒ Element
constructor
A new instance of Element.
- #inspect ⇒ Object
- #resolve(_context) ⇒ Object
Constructor Details
#initialize(map_name, path = nil) ⇒ Element
Returns a new instance of Element.
8 9 10 11 12 |
# File 'lib/ruby_reactor/template/element.rb', line 8 def initialize(map_name, path = nil) super() @map_name = map_name @path = path end |
Instance Attribute Details
#map_name ⇒ Object (readonly)
Returns the value of attribute map_name.
6 7 8 |
# File 'lib/ruby_reactor/template/element.rb', line 6 def map_name @map_name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/ruby_reactor/template/element.rb', line 6 def path @path end |
Instance Method Details
#inspect ⇒ Object
20 21 22 |
# File 'lib/ruby_reactor/template/element.rb', line 20 def inspect "element(:#{@map_name}#{", #{@path.inspect}" if @path})" end |
#resolve(_context) ⇒ Object
14 15 16 17 18 |
# File 'lib/ruby_reactor/template/element.rb', line 14 def resolve(_context) # Element resolution happens inside MapStep, not generic resolve # But if called in wrong context, raise error raise RubyReactor::Error::DependencyError, "element() can only be used within a map argument mapping" end |