Module: Musa::Extension::DynamicProxy::DynamicProxyModule
- Included in:
- DynamicProxy
- Defined in:
- lib/musa-dsl/core-ext/dynamic-proxy.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, **key_args, &block) ⇒ Object
5
6
7
8
9
10
11
12
13
|
# File 'lib/musa-dsl/core-ext/dynamic-proxy.rb', line 5
def method_missing(method_name, *args, **key_args, &block)
raise NoMethodError, "Method '#{method_name}' is unknown because self is a DynamicProxy with undefined receiver" unless @receiver
if @receiver.respond_to? method_name
@receiver.send method_name, *args, **key_args, &block
else
super
end
end
|
Instance Method Details
#==(object) ⇒ Object
43
44
45
|
# File 'lib/musa-dsl/core-ext/dynamic-proxy.rb', line 43
def ==(object)
_equalequal(object) || @receiver&.==(object)
end
|
#_eql? ⇒ Object
47
|
# File 'lib/musa-dsl/core-ext/dynamic-proxy.rb', line 47
alias _eql? eql?
|
#_equalequal ⇒ Object
41
|
# File 'lib/musa-dsl/core-ext/dynamic-proxy.rb', line 41
alias _equalequal ==
|
#_instance_of? ⇒ Object
35
|
# File 'lib/musa-dsl/core-ext/dynamic-proxy.rb', line 35
alias _instance_of? instance_of?
|
#_is_a? ⇒ Object
23
|
# File 'lib/musa-dsl/core-ext/dynamic-proxy.rb', line 23
alias _is_a? is_a?
|
#_kind_of? ⇒ Object
29
|
# File 'lib/musa-dsl/core-ext/dynamic-proxy.rb', line 29
alias _kind_of? kind_of?
|
#eql?(object) ⇒ Boolean
49
50
51
|
# File 'lib/musa-dsl/core-ext/dynamic-proxy.rb', line 49
def eql?(object)
_eql?(object) || @receiver&.eql?(object)
end
|
#has_receiver? ⇒ Boolean
19
20
21
|
# File 'lib/musa-dsl/core-ext/dynamic-proxy.rb', line 19
def has_receiver?
!@receiver.nil?
end
|
#instance_of?(klass) ⇒ Boolean
37
38
39
|
# File 'lib/musa-dsl/core-ext/dynamic-proxy.rb', line 37
def instance_of?(klass)
_instance_of?(klass) || @receiver&.instance_of?(klass)
end
|
#is_a?(klass) ⇒ Boolean
25
26
27
|
# File 'lib/musa-dsl/core-ext/dynamic-proxy.rb', line 25
def is_a?(klass)
_is_a?(klass) || @receiver&.is_a?(klass)
end
|
#kind_of?(klass) ⇒ Boolean
31
32
33
|
# File 'lib/musa-dsl/core-ext/dynamic-proxy.rb', line 31
def kind_of?(klass)
_kind_of?(klass) || @receiver&.is_a?(klass)
end
|
#respond_to_missing?(method_name, include_private) ⇒ Boolean
15
16
17
|
# File 'lib/musa-dsl/core-ext/dynamic-proxy.rb', line 15
def respond_to_missing?(method_name, include_private)
@receiver&.respond_to?(method_name, include_private) || super
end
|