Class: Commands::AddCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/commands/addcommand.rb

Instance Method Summary collapse

Constructor Details

#initialize(tracker) ⇒ AddCommand

Returns a new instance of AddCommand.



8
9
10
# File 'lib/commands/addcommand.rb', line 8

def initialize(tracker)
	@tracker = tracker
end

Instance Method Details

#help(commandcontext) ⇒ Object



21
22
23
# File 'lib/commands/addcommand.rb', line 21

def help(commandcontext)
	commandcontext.output 'Use pug add <type of report> <initial status>'
end

#run(commandcontext) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/commands/addcommand.rb', line 12

def run(commandcontext)
	type = commandcontext.pop_command! 'Missing type'
	status = commandcontext.pop_command! 'Missing status'

	title = commandcontext.prompt "Enter a title"

	@tracker.add(type, status, title)
end