Class: Amee::Config
- Inherits:
-
Object
- Object
- Amee::Config
- Defined in:
- lib/amee/config.rb
Class Attribute Summary collapse
-
.configuration ⇒ Object
Returns the value of attribute configuration.
Class Method Summary collapse
-
.[](key) ⇒ Object
Retrieve the value from the config.
-
.[]=(key, val) ⇒ Object
sets the value of the config.
- .defaults ⇒ Object
-
.delete(key) ⇒ Object
deletes the value from the config.
- .key?(key) ⇒ Boolean
-
.set {|@configuration| ... } ⇒ Object
yields the configuration.
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
4 5 6 |
# File 'lib/amee/config.rb', line 4 def configuration @configuration end |
Class Method Details
.[](key) ⇒ Object
Retrieve the value from the config
42 43 44 |
# File 'lib/amee/config.rb', line 42 def [](key) (@configuration ||= defaults)[key] end |
.[]=(key, val) ⇒ Object
sets the value of the config
47 48 49 |
# File 'lib/amee/config.rb', line 47 def []=(key, val) (@configuration ||= defaults)[key] = val end |
.defaults ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/amee/config.rb', line 6 def defaults @defaults ||= { :cache => true, :cache_store => Moneta::Memory, :expires_in => 60*60*24, :server => "stage.amee.com", :auth_path => "/auth", :accept => "application/json", :logging => true } end |
.delete(key) ⇒ Object
deletes the value from the config
52 53 54 |
# File 'lib/amee/config.rb', line 52 def delete(key) (@configuration ||= defaults).delete(key) end |
.key?(key) ⇒ Boolean
33 34 35 |
# File 'lib/amee/config.rb', line 33 def key?(key) (@configuration ||= defaults).key?(key) end |
.set {|@configuration| ... } ⇒ Object
yields the configuration
26 27 28 29 30 |
# File 'lib/amee/config.rb', line 26 def set @configuration ||= defaults yield @configuration nil end |