Module: Oni::Configurable::ClassMethods
- Defined in:
- lib/oni/configurable.rb
Instance Method Summary collapse
-
#options ⇒ Hash
Returns a Hash containing the options of the current class.
-
#set(option, value) ⇒ Object
Sets the option to the given value.
-
#set_multiple(options) ⇒ Object
Sets a number of options based on the given Hash.
Instance Method Details
#options ⇒ Hash
Returns a Hash containing the options of the current class.
64 65 66 |
# File 'lib/oni/configurable.rb', line 64 def return @options ||= {} end |
#set(option, value) ⇒ Object
Sets the option to the given value. If a Proc (or any object that
responds to #call
) is given it's not evaluated until it's accessed.
This makes it possible to for example set a logger that's not created
until an instance of the including class is created.
85 86 87 |
# File 'lib/oni/configurable.rb', line 85 def set(option, value) [option.to_sym] = value end |
#set_multiple(options) ⇒ Object
Sets a number of options based on the given Hash.
97 98 99 100 101 |
# File 'lib/oni/configurable.rb', line 97 def set_multiple() .each do |option, value| set(option, value) end end |