Method: HaveAPI::Fs::Component#use

Defined in:
lib/haveapi/fs/component.rb

#use(*names) ⇒ Object

Attempt to find and use nested components with names. Each name is for the next descendant. If the target component is found, it and all components in its path will be bound. Bound components are not automatically deleted when not in use.



106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/haveapi/fs/component.rb', line 106

def use(*names)
  ret = self
  path = []

  names.each do |n|
    ret = ret.find(n)
    return if ret.nil?
    path << ret
  end

  path.each { |c| c.bound = true }

  ret
end