Class: CatarseSettingsDb::Setting
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- CatarseSettingsDb::Setting
- Defined in:
- app/models/catarse_settings_db/setting.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.
13 14 15 16 17 18 19 |
# File 'app/models/catarse_settings_db/setting.rb', line 13 def [] *keys if keys.size == 1 get keys.shift else keys.map{|key| get key } end end |
.[]=(key, value) ⇒ Object
20 21 22 |
# File 'app/models/catarse_settings_db/setting.rb', line 20 def []= key, value set key, value end |