Class: Behavior::Base
- Inherits:
-
Object
- Object
- Behavior::Base
- Defined in:
- lib/behavior.rb
Instance Method Summary collapse
Instance Method Details
#[](key) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/behavior.rb', line 23 def [](key) begin BehaviorConfig.find_by_key(key.to_s).value rescue NoMethodError [key][:default] end end |
#all ⇒ Object
31 32 33 |
# File 'lib/behavior.rb', line 31 def all .keys end |
#meta ⇒ Object
19 20 21 |
# File 'lib/behavior.rb', line 19 def HashWithIndifferentAccess.new(YAML.load_file(Behavior::Settings.config_file)) end |
#update(attrs = {}) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/behavior.rb', line 35 def update(attrs = {}) attrs.each do |key,value| result = BehaviorConfig.find_or_create_by_key(key.to_s) result.update_attribute(:value, value) if result end end |