Class: SmartTodo::Dispatchers::Base
- Inherits:
-
Object
- Object
- SmartTodo::Dispatchers::Base
- Defined in:
- lib/smart_todo/dispatchers/base.rb
Class Method Summary collapse
-
.class_for(dispatcher) ⇒ Class
Factory pattern to retrieve the right dispatcher class.
-
.validate_options!(_options) ⇒ Object
Subclasses should define what options from the CLI they need in order to properly deliver the message.
Instance Method Summary collapse
-
#dispatch ⇒ Object
This method gets called when a TODO reminder is expired and needs to be delivered.
-
#initialize(event_message, todo_node, file, options) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(event_message, todo_node, file, options) ⇒ Base
Returns a new instance of Base.
38 39 40 41 42 43 44 |
# File 'lib/smart_todo/dispatchers/base.rb', line 38 def initialize(, todo_node, file, ) @event_message = @todo_node = todo_node @options = @file = file @assignees = @todo_node.assignees end |
Class Method Details
.class_for(dispatcher) ⇒ Class
Factory pattern to retrieve the right dispatcher class.
12 13 14 15 16 17 18 19 |
# File 'lib/smart_todo/dispatchers/base.rb', line 12 def class_for(dispatcher) case dispatcher when "slack" Slack when nil, "output" Output end end |
.validate_options!(_options) ⇒ Object
Subclasses should define what options from the CLI they need in order to properly deliver the message. For instance the Slack dispatcher requires an API key.
28 29 30 |
# File 'lib/smart_todo/dispatchers/base.rb', line 28 def () raise(NotImplemetedError, "subclass responsability") end |
Instance Method Details
#dispatch ⇒ Object
This method gets called when a TODO reminder is expired and needs to be delivered. Dispatchers should implement this method to deliver the message where they need.
50 51 52 |
# File 'lib/smart_todo/dispatchers/base.rb', line 50 def dispatch raise(NotImplemetedError, "subclass responsability") end |