Class: Workling::Routing::ClassAndMethodRouting
- Defined in:
- lib/workling/routing/class_and_method_routing.rb
Class Method Summary collapse
-
.queue_for(clazz, method) ⇒ Object
returns the routing string, given a class and method.
Instance Method Summary collapse
-
#initialize ⇒ ClassAndMethodRouting
constructor
initializes and builds routing hash.
-
#method_name(queue) ⇒ Object
returns the worker method name, given the routing string.
-
#queue_for(clazz, method) ⇒ Object
returns the routing string, given a class and method.
-
#queue_names ⇒ Object
returns all routed.
-
#queue_names_routing_class(clazz) ⇒ Object
dare you to remove this! go on!.
Constructor Details
#initialize ⇒ ClassAndMethodRouting
initializes and builds routing hash.
11 12 13 14 15 |
# File 'lib/workling/routing/class_and_method_routing.rb', line 11 def initialize super build end |
Class Method Details
.queue_for(clazz, method) ⇒ Object
returns the routing string, given a class and method.
28 29 30 |
# File 'lib/workling/routing/class_and_method_routing.rb', line 28 def self.queue_for(clazz, method) "#{ clazz.to_s.tableize }/#{ method }".split("/").join("__") # Don't split with : because it messes up memcache stats end |
Instance Method Details
#method_name(queue) ⇒ Object
returns the worker method name, given the routing string.
18 19 20 |
# File 'lib/workling/routing/class_and_method_routing.rb', line 18 def method_name(queue) queue.split("__").last end |
#queue_for(clazz, method) ⇒ Object
returns the routing string, given a class and method. delegating.
23 24 25 |
# File 'lib/workling/routing/class_and_method_routing.rb', line 23 def queue_for(clazz, method) ClassAndMethodRouting.queue_for(clazz, method) end |
#queue_names ⇒ Object
returns all routed
33 34 35 |
# File 'lib/workling/routing/class_and_method_routing.rb', line 33 def queue_names self.keys end |
#queue_names_routing_class(clazz) ⇒ Object
dare you to remove this! go on!
38 39 40 |
# File 'lib/workling/routing/class_and_method_routing.rb', line 38 def queue_names_routing_class(clazz) self.select { |x, y| y.is_a?(clazz) }.map { |x, y| x } end |