Class: Confer::Configurator
- Inherits:
-
Object
- Object
- Confer::Configurator
- Defined in:
- lib/confer/configurator.rb
Overview
Public: Encapsulates the actual interaction with the remote server.
Direct Known Subclasses
Confer::Configurators::Locale, Confer::Configurators::Tzdata
Class Method Summary collapse
-
.get(name, options = {}) ⇒ Object
Public: Find and instantiate a Configurator with the given name.
Instance Method Summary collapse
-
#apply(connection) ⇒ Object
Public: Modify the remote configuration to match the Configurator attributes.
-
#initialize(options = {}) ⇒ Configurator
constructor
Public: Instantiates a new Configurator.
-
#query(connection) ⇒ Object
Public: Query and return the remote configuration.
-
#verify(connection) ⇒ Object
Public: Verify the remote configuration against the Configurator attributes.
Constructor Details
#initialize(options = {}) ⇒ Configurator
Public: Instantiates a new Configurator. By itself this method doesn’t really do very much for the base class, however for subclasses it will attempt to apply the options passed to attributes if they exist.
options - A Hash of configurator specific options.
44 45 46 |
# File 'lib/confer/configurator.rb', line 44 def initialize( = {}) .apply_to self end |
Class Method Details
.get(name, options = {}) ⇒ Object
Public: Find and instantiate a Configurator with the given name.
name - A String containing the name of the configurator to get. options - A Hash of options to pass to the configurator.
Raises
ConfiguratorNotFoundError - If a configurator with the specified name can
not be located.
ConfiguratorError - If the configurator was found byt cannot be
instantiated for some reason.
Returns a Configurator instance if found.
28 29 30 31 32 33 34 35 |
# File 'lib/confer/configurator.rb', line 28 def self.get(name, = {}) require "confer/configurators/#{name}" Confer::Configurators.const_get(name.camelize).new() rescue LoadError => e raise ConfiguratorNotFoundError.new("Configurator #{name} not found") rescue StandardError => e raise ConfiguratorError.new(e) end |
Instance Method Details
#apply(connection) ⇒ Object
Public: Modify the remote configuration to match the Configurator attributes.
61 |
# File 'lib/confer/configurator.rb', line 61 def apply(connection); end |
#query(connection) ⇒ Object
Public: Query and return the remote configuration.
51 |
# File 'lib/confer/configurator.rb', line 51 def query(connection); end |
#verify(connection) ⇒ Object
Public: Verify the remote configuration against the Configurator attributes.
56 |
# File 'lib/confer/configurator.rb', line 56 def verify(connection); end |