class Hiptest::Nodes::Node
Attributes
children[R]
parent[RW]
Public Instance Methods
==(other)
click to toggle source
# File lib/hiptest-publisher/nodes.rb, line 54 def ==(other) other.class == self.class && other.children == @children end
each_direct_children() { |child| ... }
click to toggle source
# File lib/hiptest-publisher/nodes.rb, line 44 def each_direct_children children.each_value do |child| if child.is_a? Hiptest::Nodes::Node yield child elsif child.is_a? Array child.each {|c| yield c if c.is_a? Hiptest::Nodes::Node } end end end
each_sub_nodes(*types, deep: false) { |current_node| ... }
click to toggle source
# File lib/hiptest-publisher/nodes.rb, line 21 def each_sub_nodes(*types, deep: false) return to_enum(:each_sub_nodes, *types, deep: deep) unless block_given? path = [self] parsed_nodes_id = Set.new until path.empty? current_node = path.shift if current_node.is_a?(Node) next if parsed_nodes_id.include? current_node.object_id parsed_nodes_id << current_node.object_id if types.empty? || types.any? {|type| current_node.is_a?(type)} yield current_node next unless deep end current_node.children.each_value {|item| path << item} elsif current_node.is_a?(Array) current_node.each {|item| path << item} end end end
flat_string()
click to toggle source
# File lib/hiptest-publisher/nodes.rb, line 72 def flat_string flat_childs = children.map do |key, value| "#{key}: #{flatten_child(value)}" end.join(", ") "<#{self.class.name} [#{flat_childs}]>" end
kind()
click to toggle source
# File lib/hiptest-publisher/nodes.rb, line 66 def kind node_kinds[self.class] ||= begin self.class.name.split('::').last.downcase end end
pretty_print_instance_variables()
click to toggle source
Calls superclass method
# File lib/hiptest-publisher/nodes.rb, line 13 def pretty_print_instance_variables super - [:@parent] # do not overload pry output end
project()
click to toggle source
# File lib/hiptest-publisher/nodes.rb, line 58 def project project = self while project && !project.is_a?(Hiptest::Nodes::Project) project = project.parent end project end
render(rendering_context)
click to toggle source
# File lib/hiptest-publisher/nodes.rb, line 17 def render(rendering_context) return Hiptest::Renderer.render(self, rendering_context) end
Private Instance Methods
flatten_child(child)
click to toggle source
# File lib/hiptest-publisher/nodes.rb, line 85 def flatten_child(child) return child.flat_string if child.is_a?(Node) if child.is_a?(Array) return child.map {|item| flatten_child(item)} end child.to_s end
node_kinds()
click to toggle source
# File lib/hiptest-publisher/nodes.rb, line 81 def node_kinds @@node_kinds ||= {} end