Sha256: d6336b8dbba3669a6aaf3d565b7a14030451154db471a447f2e6f65d5b41a6c3
Contents?: true
Size: 821 Bytes
Versions: 5
Compression:
Stored size: 821 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
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
magent-0.2 | examples/simple/bot.rb |
magent-0.1.3 | examples/simple/bot.rb |
magent-0.1.2 | examples/simple/bot.rb |
magent-0.1.1 | examples/simple/bot.rb |
magent-0.1.0 | examples/simple/bot.rb |