module Foo | |
module_eval do | |
host_name = `hostname`.chomp | |
host_name_short = `hostname -s`.chomp | |
queue_name = "#{host_name}" | |
# mod = Module.new | |
# mod.module_eval %Q{ | |
# @queue = :abc #host_name | |
# def self.perform | |
# puts self.class.to_s | |
# end | |
# } | |
mod = Module.new do |submod| | |
@queue = queue_name | |
def submod.perform | |
puts self.class.to_s | |
end | |
end | |
module_name = host_name_short.sub(/^\w/){ |s| s.upcase } | |
const_set(module_name, mod) | |
end | |
end | |
require 'yaml' | |
require 'resque' | |
Foo.constants.each do |sym| | |
if const = Foo.const_get(sym) | |
Resque.enqueue(const) | |
end | |
end | |
# `resque-web` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment