Class: Hiptest::Nodes::Node
- Inherits:
-
Object
- Object
- Hiptest::Nodes::Node
- Defined in:
- lib/hiptest-publisher/nodes.rb
Direct Known Subclasses
Actionwords, Argument, Assign, BinaryExpression, Call, Dataset, Datatable, Dict, Field, Folder, IfThen, Index, Item, List, Literal, NullLiteral, Parameter, Parenthesis, Project, Property, Scenarios, Step, Tag, Template, Test, TestPlan, Tests, UnaryExpression, Variable, While
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#parent ⇒ Object
Returns the value of attribute parent.
Instance Method Summary collapse
- #direct_children ⇒ Object
- #find_sub_nodes(types = []) ⇒ Object
- #render(language = 'ruby', context = {}) ⇒ Object
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
8 9 10 |
# File 'lib/hiptest-publisher/nodes.rb', line 8 def children @children end |
#parent ⇒ Object
Returns the value of attribute parent.
8 9 10 |
# File 'lib/hiptest-publisher/nodes.rb', line 8 def parent @parent end |
Instance Method Details
#direct_children ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/hiptest-publisher/nodes.rb', line 28 def direct_children direct = [] children.each do |key, child| if child.is_a? Hiptest::Nodes::Node direct << child elsif child.is_a? Array child.each {|c| direct << c if c.is_a? Hiptest::Nodes::Node } end end direct end |
#find_sub_nodes(types = []) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/hiptest-publisher/nodes.rb', line 15 def find_sub_nodes(types = []) sub_nodes = all_sub_nodes types = [types] unless types.is_a?(Array) if types.empty? sub_nodes else sub_nodes.keep_if do |node| types.map {|type| node.is_a?(type)}.include?(true) end end end |