Module: Buby::Implants::Object

Included in:
Object
Defined in:
lib/buby/implants/jruby.rb

Instance Method Summary collapse

Instance Method Details

#implanted?(klass = nil) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/buby/implants/jruby.rb', line 4

def implanted?(klass = nil)
  self.class.ancestors.include?(klass)
end

#unique_methods(regular = true) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/buby/implants/jruby.rb', line 8

def unique_methods regular = true
  klass = self.class
  meths = self.methods regular
  while (klass != ::Object)
    meths -= JRuby.reference(klass).getMethods.each_with_object([]){|meth, arr| arr << meth.first.intern if meth.last.kind_of?(Java::OrgJrubyInternalRuntimeMethods::AliasMethod)}
    klass = klass.superclass
  end
  meths
end