Module: ConeyIsland::Performer
- Defined in:
- lib/coney_island/performer.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/coney_island/performer.rb', line 12 def method_missing(method_name, *args) method_str = method_name.to_s if method_str =~ /.*_async$/ synchronous_method = method_str.sub(/_async$/, '') if self.respond_to?(:id) && self.class.respond_to?(:find) ConeyIsland.submit(self.class, synchronous_method, instance_id: self.id, args: args, highlander: get_coney_settings[:highlander]) else ConeyIsland.submit(self.class, synchronous_method, singleton: true, args: args, highlander: get_coney_settings[:highlander]) end else super end end |
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/coney_island/performer.rb', line 4 def self.included(base) base.extend ClassMethods delegate :get_coney_settings, to: :class # http://apidock.com/rails/Class/class_attribute base.class_attribute :coney_island_settings end |