Class: Configuration
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Configuration
- Defined in:
- app/models/configuration.rb
Class Method Summary collapse
-
.[](*keys) ⇒ Object
This method returns the values of the config simulating a Hash, like: Configuration It can also bring Arrays of keys, like: Configuration[:foo, :bar] …
- .[]=(key, value) ⇒ Object
Class Method Details
.[](*keys) ⇒ Object
This method returns the values of the config simulating a Hash, like:
Configuration[:foo]
It can also bring Arrays of keys, like:
Configuration[:foo, :bar]
… so you can pass it to a method using *. It is memoized, so it will be correctly cached.
10 11 12 13 14 15 16 |
# File 'app/models/configuration.rb', line 10 def [] *keys if keys.size == 1 get keys.shift else keys.map{|key| get key } end end |
.[]=(key, value) ⇒ Object
17 18 19 |
# File 'app/models/configuration.rb', line 17 def []= key, value set key, value end |