Class: CoffeeOutside::DispatcherBase

Inherits:
Object
  • Object
show all
Defined in:
lib/coffeeoutside/dispatchers/dispatcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_timeObject (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

#forecastObject (readonly)

Returns the value of attribute forecast.



5
6
7
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 5

def forecast
  @forecast
end

#locationObject (readonly)

Returns the value of attribute location.



5
6
7
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 5

def location
  @location
end

#start_timeObject (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_methodObject



29
30
31
32
33
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 29

def debug_method
  puts "\n"
  puts self.class
  notify_debug
end

#notifyObject



21
22
23
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 21

def notify
  production? ? notify_production : debug_method
end

#notify_debugObject



35
36
37
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 35

def notify_debug
  raise "notify_production must be overridden"
end

#notify_productionObject



25
26
27
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 25

def notify_production
  raise "notify_production must be overridden"
end

#production?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/coffeeoutside/dispatchers/dispatcher.rb', line 17

def production?
  @production
end