Class: Proxy
- Inherits:
- BasicObject
- Defined in:
- lib/binary_parser/general_class/proxy.rb
Instance Method Summary collapse
-
#initialize(target, proxy_methods) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(message, *args, &block) ⇒ Object
Constructor Details
#initialize(target, proxy_methods) ⇒ Proxy
Returns a new instance of Proxy.
2 3 4 5 |
# File 'lib/binary_parser/general_class/proxy.rb', line 2 def initialize(target, proxy_methods) @target = target @proxy_methods = proxy_methods end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(message, *args, &block) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/binary_parser/general_class/proxy.rb', line 7 def method_missing(, *args, &block) if @proxy_methods.include?() @target.__send__(, *args, &block) else @target.symbol_call(, *args, &block) end end |