Module: BurgerFixins::ClassMethods
- Defined in:
- lib/burger_fixins/burger_fixins.rb
Instance Method Summary collapse
- #redis_instance(r = nil) ⇒ Object
- #setting(setting_name, setting_type = :value) ⇒ Object
- #settings_store ⇒ Object
Instance Method Details
#redis_instance(r = nil) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/burger_fixins/burger_fixins.rb', line 10 def redis_instance(r = nil) if r @@redis_instance = r else defined?(@@redis_instance) ? @@redis_instance : Redis.current end end |
#setting(setting_name, setting_type = :value) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/burger_fixins/burger_fixins.rb', line 22 def setting(setting_name, setting_type = :value) case setting_type when :string create_burger_fixins_string(setting_name) when :integer create_burger_fixins_integer(setting_name) when :array create_burger_fixins_array(setting_name) when :hash create_burger_fixins_hash(setting_name) when :boolean create_burger_fixins_boolean(setting_name) else create_burger_fixins_value(setting_name) end end |
#settings_store ⇒ Object
18 19 20 |
# File 'lib/burger_fixins/burger_fixins.rb', line 18 def settings_store Redis::Namespace.new(self.to_s, :redis => redis_instance) end |