Class: Courier::OwnerSetting
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Courier::OwnerSetting
- Defined in:
- lib/courier/owner_setting.rb
Instance Method Summary collapse
- #disabled?(template, service, args = {}) ⇒ Boolean
- #enabled?(template, service, args = {}) ⇒ Boolean
- #get(template, service) ⇒ Object
- #set(template, service, val = nil) ⇒ Object
- #settings_of_template(template) ⇒ Object
Instance Method Details
#disabled?(template, service, args = {}) ⇒ Boolean
42 43 44 |
# File 'lib/courier/owner_setting.rb', line 42 def disabled?(template, service, args={}) get(template, service)==:off end |
#enabled?(template, service, args = {}) ⇒ Boolean
38 39 40 |
# File 'lib/courier/owner_setting.rb', line 38 def enabled?(template, service, args={}) get(template, service)==:on end |
#get(template, service) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/courier/owner_setting.rb', line 31 def get(template, service) service = Courier.service(service) if service.is_a? Symbol template = Courier.template(template) if template.is_a? Symbol val = settings_of_template(template)[service.name] val || template.get(service) end |
#set(template, service, val = nil) ⇒ Object
25 26 27 28 29 |
# File 'lib/courier/owner_setting.rb', line 25 def set(template, service, val=nil) service = Courier.service(service) if service.is_a? Symbol raise 'Cant use value as argument when block given' if block_given? and val settings_of_template(template)[service.name] = block_given? ? yield : val end |