Class: Utils::IRB::Shell::MethodWrapper

Inherits:
WrapperBase show all
Defined in:
lib/utils/irb.rb

Instance Attribute Summary collapse

Attributes inherited from WrapperBase

#description, #name

Instance Method Summary collapse

Methods inherited from WrapperBase

#==, #hash

Constructor Details

#initialize(obj, name, modul) ⇒ MethodWrapper



167
168
169
170
171
# File 'lib/utils/irb.rb', line 167

def initialize(obj, name, modul)
  super(name)
  @method = modul ? obj.instance_method(name) : obj.method(name)
  @description = @method.description(style: :namespace)
end

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



173
174
175
# File 'lib/utils/irb.rb', line 173

def method
  @method
end

Instance Method Details

#<=>(other) ⇒ Object



187
188
189
# File 'lib/utils/irb.rb', line 187

def <=>(other)
  @description <=> other.description
end

#arityObject



179
180
181
# File 'lib/utils/irb.rb', line 179

def arity
  method.arity
end

#ownerObject



175
176
177
# File 'lib/utils/irb.rb', line 175

def owner
  method.respond_to?(:owner) ? method.owner : nil
end

#source_locationObject



183
184
185
# File 'lib/utils/irb.rb', line 183

def source_location
  method.source_location
end