Class: Submarine::Configuration
- Inherits:
-
Object
- Object
- Submarine::Configuration
- Defined in:
- lib/submarine/configuration.rb
Instance Attribute Summary collapse
-
#format_key ⇒ Object
Acceptable accessors.
-
#left_delimiter ⇒ Object
Acceptable accessors.
-
#right_delimiter ⇒ Object
Acceptable accessors.
-
#substitutions ⇒ Object
Acceptable accessors.
Class Method Summary collapse
-
.defaults ⇒ Object
Configuration defaults.
Instance Method Summary collapse
-
#initialize(*attrs) ⇒ Configuration
constructor
Constructs a new Configuration instance.
-
#reload! ⇒ Object
Reload the Configuration instance variables to defaults.
Constructor Details
#initialize(*attrs) ⇒ Configuration
Constructs a new Configuration instance. Merges passed in options hash, sets instance variables.
9 10 11 12 13 |
# File 'lib/submarine/configuration.rb', line 9 def initialize *attrs = attrs.empty? ? {} : attrs.first = self.class.defaults.merge() set_instance_variables end |
Instance Attribute Details
#format_key ⇒ Object
Acceptable accessors.
4 5 6 |
# File 'lib/submarine/configuration.rb', line 4 def format_key @format_key end |
#left_delimiter ⇒ Object
Acceptable accessors.
4 5 6 |
# File 'lib/submarine/configuration.rb', line 4 def left_delimiter @left_delimiter end |
#right_delimiter ⇒ Object
Acceptable accessors.
4 5 6 |
# File 'lib/submarine/configuration.rb', line 4 def right_delimiter @right_delimiter end |
#substitutions ⇒ Object
Acceptable accessors.
4 5 6 |
# File 'lib/submarine/configuration.rb', line 4 def substitutions @substitutions end |
Class Method Details
.defaults ⇒ Object
Configuration defaults.
17 18 19 20 21 22 23 24 |
# File 'lib/submarine/configuration.rb', line 17 def self.defaults { format_key: :text, # The key representing the string to be formatted left_delimiter: '[[', # The left-side matching string, ie: '[[name]]' right_delimiter: ']]', # The right-side matching string, ie: '[[name]]' substitutions: {} # Optional global default substitutions } end |
Instance Method Details
#reload! ⇒ Object
Reload the Configuration instance variables to defaults.
28 29 30 |
# File 'lib/submarine/configuration.rb', line 28 def reload! set_instance_variables(self.class.defaults) end |