Class: Lesli::Courier
- Inherits:
-
Object
- Object
- Lesli::Courier
- Defined in:
- app/lib/lesli/courier.rb
Instance Method Summary collapse
-
#call(method_name, *args) ⇒ Object
Store the method name to call on the service (e.g., :index_with_deadline).
-
#from(service_name, *args) ⇒ Object
Dynamically determine the class to call (e.g., :ticket_service as TicketService).
-
#initialize(module_name, on_error = nil) ⇒ Courier
constructor
Store the module_name (e.g., :lesli_support as LesliSupport).
Constructor Details
#initialize(module_name, on_error = nil) ⇒ Courier
Store the module_name (e.g., :lesli_support as LesliSupport)
5 6 7 8 |
# File 'app/lib/lesli/courier.rb', line 5 def initialize(module_name, on_error=nil) @module_name = module_name.to_s.camelize @on_error=on_error end |
Instance Method Details
#call(method_name, *args) ⇒ Object
Store the method name to call on the service (e.g., :index_with_deadline)
18 19 20 21 22 |
# File 'app/lib/lesli/courier.rb', line 18 def call(method_name, *args) @method_params = args @method_name = method_name self.execute end |
#from(service_name, *args) ⇒ Object
Dynamically determine the class to call (e.g., :ticket_service as TicketService)
11 12 13 14 15 |
# File 'app/lib/lesli/courier.rb', line 11 def from(service_name, *args) @service_params = args @service_name = service_name.to_s.camelize self end |