Class: Oneday::Command::Oneday

Inherits:
Thor
  • Object
show all
Defined in:
lib/oneday/command/oneday.rb

Instance Method Summary collapse

Instance Method Details

#hello(name = "teddy") ⇒ Object



7
8
9
# File 'lib/oneday/command/oneday.rb', line 7

def hello(name = "teddy")
  puts "Hello #{name}"
end

#listObject



24
25
26
27
28
# File 'lib/oneday/command/oneday.rb', line 24

def list
  Note.new(content: "demo").save
  notes = Note.all
  puts notes.inspect
end

#record(content) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/oneday/command/oneday.rb', line 13

def record(content)
  puts "I will record #{content} with project #{options[:project]}"
  project = Project.where(name: options[:project]).first || Project.create(name: options[:project])
  note = Note.new(content: content)
  note.save
  project.add_note(note)
  notes = Note.all
  puts notes.inspect
end