Class: Dato::Node

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/dato/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(node, root = nil) ⇒ Node

Returns a new instance of Node.



7
8
9
10
# File 'app/components/dato/node.rb', line 7

def initialize(node, root = nil)
  @node = node
  @root = root
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



5
6
7
# File 'app/components/dato/node.rb', line 5

def root
  @root
end

Instance Method Details

#blocksObject



16
17
18
# File 'app/components/dato/node.rb', line 16

def blocks
  root.blocks
end

#debug_nodeObject



24
25
26
# File 'app/components/dato/node.rb', line 24

def debug_node
  ("pre", JSON.pretty_generate(@node))
end

#overridesObject



20
21
22
# File 'app/components/dato/node.rb', line 20

def overrides
  root.overrides
end

#render_node(node) ⇒ Object



12
13
14
# File 'app/components/dato/node.rb', line 12

def render_node(node)
  render class_for_node(node).new(node, root)
end