Class: Sample

Inherits:
DaemonKit::RuotePseudoParticipant show all
Includes:
Nanite::Actor
Defined in:
lib/generators/daemon_kit/ruote/templates/lib/sample.rb,
lib/generators/daemon_kit/nanite_agent/templates/lib/actors/sample.rb

Overview

Sample pseudo participant

See gist.github.com/144861 for a test engine

Instance Attribute Summary

Attributes inherited from DaemonKit::RuotePseudoParticipant

#action, #workitem

Instance Method Summary collapse

Methods inherited from DaemonKit::RuotePseudoParticipant

#handle_exception, on_complete, on_exception, #perform, #run_callbacks

Instance Method Details

#dammit(exception) ⇒ Object



22
23
24
# File 'lib/generators/daemon_kit/ruote/templates/lib/sample.rb', line 22

def dammit( exception )
  workitem["error"] = exception.message
end

#echo(payload) ⇒ Object

Print to STDOUT and return



7
8
9
10
# File 'lib/generators/daemon_kit/nanite_agent/templates/lib/actors/sample.rb', line 7

def echo( payload )
  p payload
  payload
end

#errObject

Raises:

  • (ArgumentError)


18
19
20
# File 'lib/generators/daemon_kit/ruote/templates/lib/sample.rb', line 18

def err
  raise ArgumentError, "Does not compute"
end

#quoteObject



14
15
16
# File 'lib/generators/daemon_kit/ruote/templates/lib/sample.rb', line 14

def quote
  workitem["quote"] = open("http://www.iheartquotes.com/api/v1/random").read
end