Class: Capable::Configuration
- Inherits:
-
Object
- Object
- Capable::Configuration
- Defined in:
- lib/capable/configuration.rb
Constant Summary collapse
- OPTIONS =
[:verbose].freeze
Instance Attribute Summary collapse
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
-
#[](option) ⇒ Object
Allows config options to be read like a hash.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#merge(hash) ⇒ Object
Returns a hash of all configurable options merged with
hash. -
#to_hash ⇒ Object
Returns a hash of all configurable options.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 11 |
# File 'lib/capable/configuration.rb', line 8 def initialize # these defaults can be overridden in the Tokengen.config block @verbose = false end |
Instance Attribute Details
#verbose ⇒ Object
Returns the value of attribute verbose.
6 7 8 |
# File 'lib/capable/configuration.rb', line 6 def verbose @verbose end |
Instance Method Details
#[](option) ⇒ Object
Allows config options to be read like a hash
16 17 18 |
# File 'lib/capable/configuration.rb', line 16 def [](option) send(option) end |
#merge(hash) ⇒ Object
Returns a hash of all configurable options merged with hash
31 32 33 |
# File 'lib/capable/configuration.rb', line 31 def merge(hash) to_hash.merge(hash) end |
#to_hash ⇒ Object
Returns a hash of all configurable options
21 22 23 24 25 26 |
# File 'lib/capable/configuration.rb', line 21 def to_hash OPTIONS.inject({}) do |hash, option| hash[option.to_sym] = self.send(option) hash end end |