Module: Combi::Service
- Defined in:
- lib/combi/service.rb
Instance Method Summary collapse
- #actions ⇒ Object
- #async_response(&block) ⇒ Object
- #enable(*services) {|block| ... } ⇒ Object
- #no_response ⇒ Object
- #remote_methods ⇒ Object
- #service_bus ⇒ Object
- #setup(service_bus, context) ⇒ Object
- #setup_context(context) ⇒ Object
- #setup_services ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#actions ⇒ Object
30 31 32 |
# File 'lib/combi/service.rb', line 30 def actions [] end |
#async_response(&block) ⇒ Object
26 27 28 |
# File 'lib/combi/service.rb', line 26 def async_response(&block) lambda &block end |
#enable(*services) {|block| ... } ⇒ Object
42 43 44 45 |
# File 'lib/combi/service.rb', line 42 def enable(*services, &block) service_bus.enable(services) yield block if block_given? end |
#no_response ⇒ Object
22 23 24 |
# File 'lib/combi/service.rb', line 22 def no_response nil end |
#remote_methods ⇒ Object
34 35 36 |
# File 'lib/combi/service.rb', line 34 def remote_methods @_REMOTE_METHODS ||= public_methods(false) - Combi::Service.public_instance_methods end |
#service_bus ⇒ Object
38 39 40 |
# File 'lib/combi/service.rb', line 38 def service_bus @service_bus end |
#setup(service_bus, context) ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/combi/service.rb', line 2 def setup(service_bus, context) context ||= {} context[:service_bus] = service_bus setup_context(context) setup_services self end |
#setup_context(context) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/combi/service.rb', line 10 def setup_context(context) @context = context @context.keys.each do |context_var| define_singleton_method context_var do @context[context_var] end end end |
#setup_services ⇒ Object
19 20 |
# File 'lib/combi/service.rb', line 19 def setup_services end |
#to_s ⇒ Object
47 48 49 |
# File 'lib/combi/service.rb', line 47 def to_s @_TO_S ||= "#{self.class.name}" end |