Class: Laplus::Helper::MethodHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/laplus/helper/method_helper.rb

Instance Method Summary collapse

Constructor Details

#initialize(_method) ⇒ MethodHelper

Returns a new instance of MethodHelper.



6
7
8
# File 'lib/laplus/helper/method_helper.rb', line 6

def initialize(_method)
  @_method = _method
end

Instance Method Details

#alias?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/laplus/helper/method_helper.rb', line 14

def alias?
  _method.original_name != _method.name
end

#owner_singleton?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/laplus/helper/method_helper.rb', line 10

def owner_singleton?
  _method.owner.singleton_class?
end

#singleton_method_of_module?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/laplus/helper/method_helper.rb', line 18

def singleton_method_of_module?
  owner_singleton? && _method.receiver.kind_of?(Module)
end

#super_methodsObject



22
23
24
25
26
27
28
# File 'lib/laplus/helper/method_helper.rb', line 22

def super_methods
  _super_methods = [_method]
  while super_method = _super_methods.last.super_method
    _super_methods << super_method
  end
  _super_methods.reverse
end