Module: Disbatch::Plugin::Hello

Extended by:
Hello
Included in:
Hello
Defined in:
lib/disbatch/plugin/hello.rb

Instance Method Summary collapse

Instance Method Details

#execute(task) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/disbatch/plugin/hello.rb', line 3

def execute(task)
	return nil unless defined?(task) && task.respond_to?(:params)

	name = task.params['name']
	len  = rand(5)

	task.log("Hello, #{name}!")
	sleep(len)
	task.log("Goodbye, #{name}. It was a pleasure spending #{len} seconds with you.")

	puts("Executed task with params: #{task.params.inspect}")

	task.conclude
end

#paramsObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/disbatch/plugin/hello.rb', line 18

def params
	return [
		{
			'name' => 'name',
			'type' => 'string',
			'default' => 'world',
			'description' => 'some person or thing to greet'
		}
	]
end