Class: Bemer::Tree::BaseNode
- Inherits:
-
Object
- Object
- Bemer::Tree::BaseNode
- Extended by:
- Forwardable
- Defined in:
- lib/bemer/tree/base_node.rb
Instance Attribute Summary collapse
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
-
#entity_builder ⇒ Object
readonly
Returns the value of attribute entity_builder.
-
#tree ⇒ Object
readonly
Returns the value of attribute tree.
Instance Method Summary collapse
-
#initialize(tree, block = '', element = nil, **options, &content) ⇒ BaseNode
constructor
A new instance of BaseNode.
- #need_replace? ⇒ Boolean
- #print(level = 0) ⇒ Object
- #render ⇒ Object
Constructor Details
#initialize(tree, block = '', element = nil, **options, &content) ⇒ BaseNode
Returns a new instance of BaseNode.
15 16 17 18 19 20 |
# File 'lib/bemer/tree/base_node.rb', line 15 def initialize(tree, block = '', element = nil, **, &content) @entity = Entity.new(block, element, , &content) @entity_builder = EntityBuilder.new(block, element, , &content) @renderer = Renderer.new @tree = tree end |
Instance Attribute Details
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
10 11 12 |
# File 'lib/bemer/tree/base_node.rb', line 10 def entity @entity end |
#entity_builder ⇒ Object (readonly)
Returns the value of attribute entity_builder.
10 11 12 |
# File 'lib/bemer/tree/base_node.rb', line 10 def entity_builder @entity_builder end |
#tree ⇒ Object (readonly)
Returns the value of attribute tree.
10 11 12 |
# File 'lib/bemer/tree/base_node.rb', line 10 def tree @tree end |
Instance Method Details
#need_replace? ⇒ Boolean
34 35 36 |
# File 'lib/bemer/tree/base_node.rb', line 34 def need_replace? false end |
#print(level = 0) ⇒ Object
28 29 30 31 32 |
# File 'lib/bemer/tree/base_node.rb', line 28 def print(level = 0) prefix = ' ' * level puts [prefix, name, "(#{object_id})"].join end |
#render ⇒ Object
22 23 24 25 26 |
# File 'lib/bemer/tree/base_node.rb', line 22 def render entity_builder.content = capture_content renderer.render(entity_builder) end |