class Yasuri::MapNode
Attributes
children[R]
name[R]
Public Class Methods
new(name, children, **opt)
click to toggle source
# File lib/yasuri/yasuri_map_node.rb, line 7 def initialize(name, children, **opt) @name = name @children = children @opt = opt end
Public Instance Methods
inject(agent, page, opt = {}, _element = page)
click to toggle source
# File lib/yasuri/yasuri_map_node.rb, line 13 def inject(agent, page, opt = {}, _element = page) child_results_kv = @children.map do |node| [node.name, node.inject(agent, page, opt)] end Hash[child_results_kv] end
node_type_str()
click to toggle source
# File lib/yasuri/yasuri_map_node.rb, line 36 def node_type_str "map".freeze end
opts()
click to toggle source
# File lib/yasuri/yasuri_map_node.rb, line 32 def opts {} end
to_h()
click to toggle source
# File lib/yasuri/yasuri_map_node.rb, line 20 def to_h node_hash = {} self.opts.each { |k, v| node_hash[k] = v unless v.nil? } children.each do |child| child_node_name = "#{child.node_type_str}_#{child.name}" node_hash[child_node_name] = child.to_h end node_hash end