Class: Configurability::SettingInstaller
- Inherits:
-
Object
- Object
- Configurability::SettingInstaller
- Extended by:
- Loggability
- Defined in:
- lib/configurability/setting_installer.rb
Overview
Methods for declaring config methods and constants inside a configurability
block.
Instance Attribute Summary collapse
-
#target ⇒ Object
readonly
The target object.
Instance Method Summary collapse
-
#initialize(target) ⇒ SettingInstaller
constructor
Create a new Generator that can be used to add configuration methods and constants to the specified
targetobject. -
#setting(name, **options, &block) ⇒ Object
Declare a config setting with the specified
name. -
#setting_default(name, new_default) ⇒ Object
Declare a new default for the setting with the specified
name.
Constructor Details
#initialize(target) ⇒ SettingInstaller
Create a new Generator that can be used to add configuration methods and
constants to the specified target object.
19 20 21 22 |
# File 'lib/configurability/setting_installer.rb', line 19 def initialize( target ) @target = target @lexed = nil end |
Instance Attribute Details
#target ⇒ Object (readonly)
The target object
27 28 29 |
# File 'lib/configurability/setting_installer.rb', line 27 def target @target end |
Instance Method Details
#setting(name, **options, &block) ⇒ Object
Declare a config setting with the specified name.
31 32 33 34 35 36 37 38 |
# File 'lib/configurability/setting_installer.rb', line 31 def setting( name, **, &block ) self.log.debug " adding %s setting to %p" % [ name, self.target ] [:alias] = Array( [:alias] ) self.add_comment_accessor( name, ) self.add_setting_accessors( name, , &block ) self.add_default( name, [:default] ) end |
#setting_default(name, new_default) ⇒ Object
Declare a new default for the setting with the specified name.
42 43 44 |
# File 'lib/configurability/setting_installer.rb', line 42 def setting_default( name, new_default ) self.add_default( name, new_default ) end |