Class: ConfigToolkit::HashWriter
- Defined in:
- lib/configtoolkit/hashwriter.rb
Overview
This class implements a no-op Writer interface. An instance simply stores the last Hash passed to its write method.
See Hash.txt for more details.
Instance Attribute Summary collapse
-
#config_hash ⇒ Object
readonly
This is set by the argument to write.
Instance Method Summary collapse
-
#require_symbol_parameter_names? ⇒ Boolean
Returns: Returns
true
, since the HashWriter requires Symbol parameter names in the Hash passed to write. -
#write(config_hash, containing_object_name) ⇒ Object
Description: This method sets the
config_hash
attribute to theconfig_hash
argument, modified to reflect acontaining_object_name
containing object.
Methods inherited from Writer
#create_containing_object_hash
Instance Attribute Details
#config_hash ⇒ Object (readonly)
This is set by the argument to write.
17 18 19 |
# File 'lib/configtoolkit/hashwriter.rb', line 17 def config_hash @config_hash end |
Instance Method Details
#require_symbol_parameter_names? ⇒ Boolean
Returns:
Returns true
, since the HashWriter requires Symbol parameter names in the Hash passed to write.
24 25 26 |
# File 'lib/configtoolkit/hashwriter.rb', line 24 def require_symbol_parameter_names? return true end |
#write(config_hash, containing_object_name) ⇒ Object
Description:
This method sets the config_hash
attribute to the config_hash
argument, modified to reflect a containing_object_name
containing object.
Parameters:
- config_hash
-
The new value of the
config_hash
attribute, modified to reflect acontaining_object_name
containing object - containing_object_name
-
The configuration’s containing object name
40 41 42 |
# File 'lib/configtoolkit/hashwriter.rb', line 40 def write(config_hash, containing_object_name) @config_hash = create_containing_object_hash(config_hash, containing_object_name) end |