Class: Hiptest::Nodes::TestPlan
- Defined in:
- lib/hiptest-publisher/nodes.rb
Instance Attribute Summary
Attributes inherited from Node
Instance Method Summary collapse
- #find_folder_by_uid(uid) ⇒ Object
-
#initialize(folders = []) ⇒ TestPlan
constructor
A new instance of TestPlan.
- #organize_folders ⇒ Object
Methods inherited from Node
#==, #each_direct_children, #each_sub_nodes, #flat_string, #kind, #pretty_print_instance_variables, #project, #render
Constructor Details
#initialize(folders = []) ⇒ TestPlan
Returns a new instance of TestPlan.
519 520 521 522 523 524 525 526 |
# File 'lib/hiptest-publisher/nodes.rb', line 519 def initialize(folders = []) super() @uids_mapping = {} @children = { root_folder: nil, folders: folders } end |
Instance Method Details
#find_folder_by_uid(uid) ⇒ Object
545 546 547 |
# File 'lib/hiptest-publisher/nodes.rb', line 545 def find_folder_by_uid(uid) return @uids_mapping[uid] end |
#organize_folders ⇒ Object
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 |
# File 'lib/hiptest-publisher/nodes.rb', line 528 def organize_folders @children[:root_folder] = @children[:folders].find(&:root?) @children[:root_folder].parent = self if @children[:root_folder] @children[:folders].each do |folder| @uids_mapping[folder.uid] = folder end @children[:folders].each do |folder| next if folder.root? parent = find_folder_by_uid(folder.parent_uid) || @children[:root_folder] folder.parent = parent parent.children[:subfolders] << folder unless parent.children[:subfolders].include?(folder) end end |