Module: Introspection::Receivers

Included in:
Object
Defined in:
lib/introspection/receivers.rb

Defined Under Namespace

Classes: NullMetaclass, NullReceiver

Instance Method Summary collapse

Instance Method Details

#local_receiversObject


27
28
29
30
31
32
33
# File 'lib/introspection/receivers.rb', line 27

def local_receivers
  receivers = []
  receivers << __metaclass__ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.1.0')
  receivers += __metaclass__.ancestors
  receivers -= superklass.__metaclass__.ancestors
  receivers
end

#receiversObject


35
36
37
# File 'lib/introspection/receivers.rb', line 35

def receivers
  local_receivers + superklass.receivers
end

#superklassObject


23
24
25
# File 'lib/introspection/receivers.rb', line 23

def superklass
  respond_to?(:superclass) ? superclass : NullReceiver.new
end