Class: Carioca::Services::ProxyDebug
- Inherits:
-
Object
- Object
- Carioca::Services::ProxyDebug
- Defined in:
- lib/carioca/services/debug.rb
Overview
Service Debug of Carioca Proxy Class Debug for devs
Instance Method Summary collapse
-
#initialize(_options) ⇒ ProxyDebug
constructor
ProxyDebug service constructor (has a class proxy => so a service proxy).
-
#method_missing(methodname, *args, &block) ⇒ Object
method_missing overload to make the class proxy efficient.
Constructor Details
#initialize(_options) ⇒ ProxyDebug
ProxyDebug service constructor (has a class proxy => so a service proxy)
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/carioca/services/debug.rb', line 31 def initialize() = Methodic.() .specify_classes_of :service => String .specify_presence_of([:service]) .validate! if [:params] then @obj = Registry.init.start_service :name => [:service], :params => [:params] else @obj = Registry.init.start_service :name => [:service] end @log = Registry.init.get_service :name => 'logger' @mapped_service = [:service] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(methodname, *args, &block) ⇒ Object
method_missing overload to make the class proxy efficient
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/carioca/services/debug.rb', line 46 def method_missing(methodname, *args,&block) @log.debug("ProxyDebug") { "BEGIN CALL for mapped service #{@mapped_service} "} @log.debug("ProxyDebug") { "called: #{methodname} " } @log.debug("ProxyDebug") { "args : #{args.join " "}" } if block_given? then @log.debug("ProxyDebug") { "block given" } a = @obj.send(methodname, *args,&block) else a = @obj.send(methodname, *args) end @log.debug("ProxyDebug") { "=> returned: #{a} " } @log.debug("ProxyDebug") { 'END CALL' } return a end |