Class: TaskRepository
- Inherits:
-
Object
- Object
- TaskRepository
- Defined in:
- lib/djin/repositories/task_repository.rb
Instance Method Summary collapse
- #add(*tasks) ⇒ Object
- #all ⇒ Object
- #find_by_names(names) ⇒ Object
-
#initialize(tasks = []) ⇒ TaskRepository
constructor
A new instance of TaskRepository.
Constructor Details
#initialize(tasks = []) ⇒ TaskRepository
Returns a new instance of TaskRepository.
4 5 6 |
# File 'lib/djin/repositories/task_repository.rb', line 4 def initialize(tasks = []) @tasks = tasks end |
Instance Method Details
#add(*tasks) ⇒ Object
8 9 10 |
# File 'lib/djin/repositories/task_repository.rb', line 8 def add(*tasks) @tasks += tasks end |
#all ⇒ Object
12 13 14 |
# File 'lib/djin/repositories/task_repository.rb', line 12 def all @tasks end |
#find_by_names(names) ⇒ Object
16 17 18 |
# File 'lib/djin/repositories/task_repository.rb', line 16 def find_by_names(names) @tasks.select { |task| names.include?(task.name) } end |