Module: Sqreen::Backport::OriginalName

Included in:
Method, UnboundMethod
Defined in:
lib/sqreen/backport/original_name.rb

Defined Under Namespace

Modules: ClassMethods Classes: Store

Constant Summary collapse

HAS_UNBOUND_METHOD_ORIGINAL_NAME =
::UnboundMethod.instance_methods(false).include?(:original_name)
HAS_METHOD_ORIGINAL_NAME =
::Method.instance_methods(false).include?(:original_name)

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



36
37
38
# File 'lib/sqreen/backport/original_name.rb', line 36

def included(klass)
  klass.extend(ClassMethods)
end

.prepended(klass) ⇒ Object



40
41
42
# File 'lib/sqreen/backport/original_name.rb', line 40

def prepended(klass)
  klass.extend(ClassMethods)
end

.supported?Boolean

Returns:

  • (Boolean)


30
31
32
33
34
# File 'lib/sqreen/backport/original_name.rb', line 30

def supported?
  !::Kernel.const_defined?(:JRUBY_VERSION) &&
    HAS_UNBOUND_METHOD_ORIGINAL_NAME &&
    HAS_METHOD_ORIGINAL_NAME
end

Instance Method Details

#original_nameObject



13
14
15
# File 'lib/sqreen/backport/original_name.rb', line 13

def original_name
  self.class.get_original_name(owner, original_name_key) || self.original_name = name
end