| Module | DaemonKit::Configurable::ClassMethods |
| In: |
lib/daemon_kit/core_ext/configurable.rb
|
Create a configurable value on any instance, which can contain a default value, and/or be locked.
Create a standard getter/setter without a default value
configurable :foo
Create a getter/setter with a default value
configurable :foo, true
The final argument can be an options hash, which currently respects only one key: locked (false by default). Locking a configurable means the value can only be set once by the setter method.
configurable :foo, :locked => true
As long as the getter method (foo) returns nil, the standard setter method will work. As soon as the getter returns a non-nil value the setter won‘t set a new value. To set a new value you‘ll have to explicitly use the set instance method.