Sha256: 319496f03233caee770f0028d55558ef40092dfe3be91a65ab43183e16fdf83d
Contents?: true
Size: 725 Bytes
Versions: 2
Compression:
Stored size: 725 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 end Magent.register(Bot.new) if $0 == __FILE__ Magent::Processor.new(Magent.current_actor).run! end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
magent-0.0.3 | examples/simple/bot.rb |
magent-0.0.2 | examples/simple/bot.rb |