Method: CWM::UIState#find_tree_node

Defined in:
library/cwm/src/lib/cwm/ui_state.rb

#find_tree_node(pages) ⇒ CWM::Page?

Select the page to open in the general tree after a redraw

Parameters:

  • pages (Array<CWM::Page>)

    all the pages in the tree

Returns:



128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'library/cwm/src/lib/cwm/ui_state.rb', line 128

def find_tree_node(pages)
  candidate_nodes.each.with_index do |candidate, idx|
    result = pages.find { |page| matches?(page, candidate) }
    if result
      # If we had to use one of the fallbacks, the tab name is not longer
      # trustworthy
      self.tab = nil unless idx.zero?
      return result
    end
  end
  self.tab = nil
  nil
end