-
-
Save kyanny/1662122 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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