Module: Appfuel::Config::Search

Included in:
DefinitionDsl
Defined in:
lib/appfuel/config/search.rb

Instance Method Summary collapse

Instance Method Details

#[](name) ⇒ Object

Allow you to access child definitions as if it were a hash. If you add a space separated list of names this will traverse the child hierarchy and return the last name in the list

Parameters:

  • name

    String name or names to search

Returns:

  • Definition | nil



10
11
12
# File 'lib/appfuel/config/search.rb', line 10

def [](name)
  find @children, name.to_s.split(" ")
end

#search(*names) ⇒ Object

Allows you to search child definitions using an array of names instead of a space separated string

Parameters:

  • names

    Array of strings

Returns:

  • Definition | nil



19
20
21
22
# File 'lib/appfuel/config/search.rb', line 19

def search(*names)
  return nil if names.empty?
  find children, names
end