Class: AutomateIt::FieldManager
- Inherits:
-
Plugin::Manager
- Object
- Common
- Plugin::Base
- Plugin::Manager
- AutomateIt::FieldManager
- Defined in:
- lib/automateit/field_manager.rb
Overview
FieldManager
The FieldManager provides a way of accessing a hash of constants. These are useful for storing configuration data seperately from recipes. # Fields are typically stored in a Project’s config/fields.yml
file.
Fields can also be queried from the Unix shell using aifield
, run aifield --help
for details.
Defined Under Namespace
Classes: BaseDriver, Struct, YAML
Constant Summary
Constants included from Constants
Constants::HELPERS_DIR, Constants::INSTALL_DIR, Constants::PERROR, Constants::PEXEC, Constants::PNOTE, Constants::WARNING_BOILERPLATE
Instance Attribute Summary
Attributes inherited from Plugin::Manager
Attributes inherited from Common
Instance Method Summary collapse
-
#lookup(search = nil) ⇒ Object
Lookup a field.
Methods inherited from Plugin::Manager
#[], abstract_manager, alias_methods, #available?, #default, #default=, #dispatch, #dispatch_safely, #dispatch_safely_to, #dispatch_to, driver_classes, #driver_for, #driver_suitability_levels_for, inherited, #instantiate_drivers, #setup
Methods inherited from Plugin::Base
Methods inherited from Common
#initialize, #log, #nitpick, #noop, #noop=, #noop?, #preview, #preview=, #preview?, #preview_for, #setup, #superuser?, #writing, #writing=, #writing?
Constructor Details
This class inherits a constructor from AutomateIt::Common
Instance Method Details
#lookup(search = nil) ⇒ Object
Lookup a field.
For example, consider a field.yml
that contains YAML like:
foo: bar
my_app:
my_key: my_value
With the above file, we can query the fields like this:
lookup(:foo) # => "bar"
lookup("foo") # => "bar"
lookup("my_app#my_key") # => "my_value"
lookup("my_app#my_branch") # => "my_value"
You can get a reference to the entire hash:
lookup("*")
If a field isn’t found, a IndexError is raised.
29 |
# File 'lib/automateit/field_manager.rb', line 29 def lookup(search=nil) dispatch(search) end |