Sha256: 676c285466de02bb74431ee9e94846a0d62155dd66830b88da5f248becc846fe
Contents?: true
Size: 746 Bytes
Versions: 1
Compression:
Stored size: 746 Bytes
Contents
module Yasuri class MapNode attr_reader :name, :children def initialize(name, children, **opt) @name = name @children = children @opt = opt end 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 def to_h node_hash = {} self.opts.each{|k, v| node_hash[k] = v if not 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 def opts {} end def node_type_str "map".freeze end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yasuri-3.2.0 | lib/yasuri/yasuri_map_node.rb |