Class: Intent::Verbs::Add

Inherits:
Object
  • Object
show all
Defined in:
lib/intent/verbs/add.rb

Instance Method Summary collapse

Constructor Details

#initialize(documents) ⇒ Add

Returns a new instance of Add.



4
5
6
# File 'lib/intent/verbs/add.rb', line 4

def initialize(documents)
  @documents = documents
end

Instance Method Details

#invoke_append(ledger, noun) ⇒ Object



14
15
16
17
18
# File 'lib/intent/verbs/add.rb', line 14

def invoke_append(ledger, noun)
  ledger = @documents.send(scope)
  ledger.append(new Todo::Task(noun.todo_s))
  ledger.save!
end

#invoke_prepend(scope, noun) ⇒ Object



8
9
10
11
12
# File 'lib/intent/verbs/add.rb', line 8

def invoke_prepend(scope, noun)
  ledger = @documents.send(scope)
  ledger.prepend(new Todo::Task(noun.todo_s))
  ledger.save!
end