Module: Fumoffu::Utils::ComponentSearch

Included in:
Handler
Defined in:
lib/fumoffu/utils/component_search.rb

Instance Method Summary collapse

Instance Method Details

#component_by_name(component, target) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/fumoffu/utils/component_search.rb', line 4

def component_by_name component, target
  name = component.getName
  return component unless name.nil? or name != target
    
  if component.getParent then
    component_by_name(component.getParent, target)
  else
    return nil
  end
end

#component_child_by_name(component, target) ⇒ Object



15
16
17
18
19
20
# File 'lib/fumoffu/utils/component_search.rb', line 15

def component_child_by_name component, target
  component.getComponents.each do |child_component|
    return child_component unless child_component.getName != target
  end
  return nil
end