Class: CoffeeOutside::DispatcherBase
- Inherits:
-
Object
- Object
- CoffeeOutside::DispatcherBase
- Defined in:
- lib/coffeeoutside/dispatchers/dispatcher.rb
Direct Known Subclasses
IcalDispatcher, JsonDispatcher, RssDispatcher, StdoutDispatcher
Instance Attribute Summary collapse
-
#end_time ⇒ Object
readonly
Returns the value of attribute end_time.
-
#forecast ⇒ Object
readonly
Returns the value of attribute forecast.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
Instance Method Summary collapse
- #debug_method ⇒ Object
-
#initialize(config) ⇒ DispatcherBase
constructor
A new instance of DispatcherBase.
- #notify ⇒ Object
- #notify_debug ⇒ Object
- #notify_production ⇒ Object
- #production? ⇒ Boolean
Constructor Details
#initialize(config) ⇒ DispatcherBase
Returns a new instance of DispatcherBase.
7 8 9 10 11 12 13 14 15 |
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 7 def initialize(config) @start_time = config[:start_time] @end_time = config[:end_time] @location = config[:location] @forecast = config[:forecast] @production = config[:production] # Save parameters for further use by subclasses @params = config end |
Instance Attribute Details
#end_time ⇒ Object (readonly)
Returns the value of attribute end_time.
5 6 7 |
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 5 def end_time @end_time end |
#forecast ⇒ Object (readonly)
Returns the value of attribute forecast.
5 6 7 |
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 5 def forecast @forecast end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
5 6 7 |
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 5 def location @location end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
5 6 7 |
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 5 def start_time @start_time end |
Instance Method Details
#debug_method ⇒ Object
29 30 31 32 33 |
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 29 def debug_method puts "\n" puts self.class notify_debug end |
#notify ⇒ Object
21 22 23 |
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 21 def notify production? ? notify_production : debug_method end |
#notify_debug ⇒ Object
35 36 37 |
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 35 def notify_debug raise "notify_production must be overridden" end |
#notify_production ⇒ Object
25 26 27 |
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 25 def notify_production raise "notify_production must be overridden" end |
#production? ⇒ Boolean
17 18 19 |
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 17 def production? @production end |