Module: Cargobull::Service
- Defined in:
- lib/cargobull/service.rb
Class Method Summary collapse
- .dispatch ⇒ Object
- .dispatch_to(action) ⇒ Object
- .included(base) ⇒ Object
- .register(klass_name) ⇒ Object
Class Method Details
.dispatch ⇒ Object
6 7 8 |
# File 'lib/cargobull/service.rb', line 6 def self.dispatch return @dispatch end |
.dispatch_to(action) ⇒ Object
10 11 12 13 14 |
# File 'lib/cargobull/service.rb', line 10 def self.dispatch_to(action) return dispatch.detect do |klass_name| next klass_name.underscore == action.to_s end end |
.included(base) ⇒ Object
20 21 22 |
# File 'lib/cargobull/service.rb', line 20 def self.included(base) register(base.name) end |
.register(klass_name) ⇒ Object
16 17 18 |
# File 'lib/cargobull/service.rb', line 16 def self.register(klass_name) @dispatch << klass_name unless @dispatch.include?(klass_name) end |