Module: Rubeus::Reflection::JavaMethods::JavaClass

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



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rubeus/reflection/java_methods.rb', line 33

def method_missing(method_name, *args, &block)
  modifiers, metatype = JavaMethods.parse(method_name)
  if modifiers
    metatype ||= 'class'
    result = self.send("declared_#{metatype}_methods")
    result = result.send((metatype == 'class') ? :select : :reject, &:static?)
    modifiers.each do |modifier|
      predication = "#{modifier}?".to_sym
      result = result.select(&predication)
    end
    result
  else
    super
  end
end

Instance Method Details

#respond_to?(method_name) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
52
# File 'lib/rubeus/reflection/java_methods.rb', line 49

def respond_to?(method_name)
  modifiers, metatype = JavaMethods.parse(method_name)
  !!modifiers || super
end