Module: Rubeus::Reflection::JavaMethods::Object
- Defined in:
- lib/rubeus/reflection/java_methods.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/rubeus/reflection/java_methods.rb', line 56
def method_missing(method_name, *args, &block)
modifiers, metatype = JavaMethods.parse(method_name)
return super unless modifiers
if is_a?(Module)
case metatype
when nil then to_java_methods(method_name)
when 'class' then to_java_methods(method_name)
when 'instance' then to_java_methods(method_name) else
raise "something wrong..."
end
else
case metatype
when nil then self.class.send(method_name.to_s.gsub(/_methods$/, '_instance_methods'), *args, &block)
when 'class' then raise NoMethodError
when 'instance' then self.class.send(method_name, *args, &block)
else
raise "something wrong..."
end
end
end
|
Instance Method Details
#respond_to?(method_name) ⇒ Boolean
78
79
80
81
82
83
|
# File 'lib/rubeus/reflection/java_methods.rb', line 78
def respond_to?(method_name)
modifiers, metatype = JavaMethods.parse(method_name)
return super unless modifiers
return true if is_a?(Module)
metatype != 'class'
end
|