Class: Task::DataInterface::Interface
- Inherits:
-
Object
- Object
- Task::DataInterface::Interface
- Defined in:
- lib/task/data_interface/interface.rb
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
Instance Method Summary collapse
-
#all(task_list) ⇒ Enumerator::Lazy<Task::Task>
Returns all tasks for the provided task list.
-
#delete(task_list, task_id) ⇒ Object
Deletes the task with the given id.
-
#find(task_list, task_id) ⇒ Task::Task|NilClass
Returns the task with the given id.
-
#initialize(options = {}) ⇒ Interface
constructor
A new instance of Interface.
-
#store(task) ⇒ Object
Stores a task in the data store.
Constructor Details
#initialize(options = {}) ⇒ Interface
Returns a new instance of Interface.
22 23 24 |
# File 'lib/task/data_interface/interface.rb', line 22 def initialize( = {}) @adapter = [:adapter] || self.class.adapter_builder.call() end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
7 8 9 |
# File 'lib/task/data_interface/interface.rb', line 7 def adapter @adapter end |
Instance Method Details
#all(task_list) ⇒ Enumerator::Lazy<Task::Task>
Returns all tasks for the provided task list
34 35 36 |
# File 'lib/task/data_interface/interface.rb', line 34 def all(task_list) adapter.all(task_list) end |
#delete(task_list, task_id) ⇒ Object
Deletes the task with the given id.
49 50 51 |
# File 'lib/task/data_interface/interface.rb', line 49 def delete(task_list, task_id) adapter.delete(task_list, task_id) end |
#find(task_list, task_id) ⇒ Task::Task|NilClass
Returns the task with the given id
42 43 44 |
# File 'lib/task/data_interface/interface.rb', line 42 def find(task_list, task_id) adapter.find(task_list, task_id) end |
#store(task) ⇒ Object
Stores a task in the data store
27 28 29 |
# File 'lib/task/data_interface/interface.rb', line 27 def store(task) adapter.store(task) end |