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
32 33 34 |
# File 'lib/combi/service.rb', line 32 def actions [] end |
#async_response(&block) ⇒ Object
28 29 30 |
# File 'lib/combi/service.rb', line 28 def async_response(&block) lambda &block end |
#enable(*services) {|block| ... } ⇒ Object
44 45 46 47 |
# File 'lib/combi/service.rb', line 44 def enable(*services, &block) service_bus.enable(services) yield block if block_given? end |
#no_response ⇒ Object
24 25 26 |
# File 'lib/combi/service.rb', line 24 def no_response nil end |
#remote_methods ⇒ Object
36 37 38 |
# File 'lib/combi/service.rb', line 36 def remote_methods @_REMOTE_METHODS ||= public_methods(false) - Combi::Service.public_instance_methods end |
#service_bus ⇒ Object
40 41 42 |
# File 'lib/combi/service.rb', line 40 def service_bus @service_bus end |
#setup(service_bus, context) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/combi/service.rb', line 4 def setup(service_bus, context) context ||= {} context[:service_bus] = service_bus setup_context(context) setup_services self end |
#setup_context(context) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/combi/service.rb', line 12 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
21 22 |
# File 'lib/combi/service.rb', line 21 def setup_services end |
#to_s ⇒ Object
49 50 51 |
# File 'lib/combi/service.rb', line 49 def to_s @_TO_S ||= "#{self.class.name}" end |