Sha256: 1f16b5377839083b40dcbe35dcc7797fb152ae216e56e73d6cf45c6c84c69da5
Contents?: true
Size: 1.32 KB
Versions: 5
Compression:
Stored size: 1.32 KB
Contents
module Mack module Distributed module Routes # A class used to house the Mack::Routes::Url module for distributed applications. # Functionally this class does nothing, but since you can't cache a module, a class is needed. class Urls def initialize(dsd) # :nodoc: @dsd = dsd @url_method_list = {} end # def add_url_method(key, meth) # @url_method_list[key.to_sym] = meth # end def []=(key, method) @url_method_list[key.to_sym] = method @runner = nil end def run if @runner.nil? klass_name = String.randomize(40).downcase.camelcase meths = "" @url_method_list.each_pair {|k,v| meths += v + "\n\n"} eval %{ class Mack::Distributed::Routes::Temp::M#{klass_name} include Mack::Routes::Urls def initialize(dsd) @dsd = dsd end #{meths} end } @runner = "Mack::Distributed::Routes::Temp::M#{klass_name}".constantize.new(@dsd) end @runner end end # Urls module Temp # :nodoc: end # Temp end # Routes end # Distributed end # Mack
Version data entries
5 entries across 5 versions & 1 rubygems