Sha256: 4638a94bc18a6407fbcbbc3a3bef4178dde3180acaa5bc4e662e9990447e4596
Contents?: true
Size: 817 Bytes
Versions: 4
Compression:
Stored size: 817 Bytes
Contents
$:.unshift File.dirname(__FILE__)+"/../../lib/" require 'magent' # Use: magent /path/to/this/file Magent.push("bots", :echo, "hello, world") Magent.push("bots", :do_task, "File", :exist?, "/etc/passwd") Magent.push("bots", :echo, "Press ctrl+c to close") Magent.push("bots", :do_not_exist, "you should not see this message") class Bot include Magent::Actor channel_name "bots" expose :echo, :do_task def echo(payload) $stderr.puts payload.inspect end def do_task(payload) klass, *args = payload result = Object.module_eval(klass).send(*args) $stderr.puts "RESULT: #{result}" end at_least_every 15 do puts "Hi there!, you'll see this message again in ~15 seconds" end end Magent.register(Bot.new) if $0 == __FILE__ Magent::Processor.new(Magent.current_actor).run! end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
magent-0.4.2 | examples/simple/bot.rb |
thirtysixthspan-magent-0.4.1 | examples/simple/bot.rb |
magent-0.4 | examples/simple/bot.rb |
magent-0.3 | examples/simple/bot.rb |