Class: Granite::PerformerProxy::Proxy
- Inherits:
-
Object
- Object
- Granite::PerformerProxy::Proxy
- Defined in:
- lib/granite/performer_proxy/proxy.rb
Overview
Proxy helps to wrap the following method call with performer-enabled context.
Instance Method Summary collapse
-
#initialize(klass, performer) ⇒ Proxy
constructor
A new instance of Proxy.
- #inspect ⇒ Object
- #method_missing(method, *args, &block) ⇒ Object
- #respond_to_missing?(*args) ⇒ Boolean
Constructor Details
#initialize(klass, performer) ⇒ Proxy
Returns a new instance of Proxy.
7 8 9 10 |
# File 'lib/granite/performer_proxy/proxy.rb', line 7 def initialize(klass, performer) @klass = klass @performer = performer end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/granite/performer_proxy/proxy.rb', line 16 def method_missing(method, *args, &block) if @klass.respond_to?(method) @klass.with_proxy_performer(@performer) do @klass.public_send(method, *args, &block) end else super end end |
Instance Method Details
#inspect ⇒ Object
12 13 14 |
# File 'lib/granite/performer_proxy/proxy.rb', line 12 def inspect "<#{@klass}PerformerProxy #{@performer}>" end |
#respond_to_missing?(*args) ⇒ Boolean
26 27 28 |
# File 'lib/granite/performer_proxy/proxy.rb', line 26 def respond_to_missing?(*args) @klass.respond_to?(*args) end |