Sha256: dbccb350ee8269a819484125000173192f7b0b914a7ebe399275a167a6ac4401
Contents?: true
Size: 1.14 KB
Versions: 9
Compression:
Stored size: 1.14 KB
Contents
module Mack # :nodoc: module Routes # :nodoc: module Urls # Retrieves a distributed route from a DRb server. # # Example: # distributed_url(:app_1, :home_page_url) # distributed_url(:registration_app, :signup_url, {:from => :google}) def distributed_url(app_name, route_name, options = {}) route_name = route_name.to_s if route_name.match(/_url$/) unless route_name.match(/_distributed_url$/) route_name.gsub!("_url", "_distributed_url") end else route_name << "_distributed_url" end if !configatron.mack.distributed.app_name.nil? && app_name.to_sym == configatron.mack.distributed.app_name.to_sym # if it's local let's just use it and not go out to Rinda return self.send(route_name, options) end d_urls = Mack::Distributed::Routes::Urls.get(app_name) raise Mack::Distributed::Errors::UnknownRouteName.new(app_name, route_name) unless d_urls.respond_to?(route_name) return d_urls.run(route_name, options) end # distributed_url end # Urls end # Routes end # Mack
Version data entries
9 entries across 9 versions & 1 rubygems