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

Returns a new instance of MethodWrapper.



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

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.



193
194
195
# File 'lib/utils/irb.rb', line 193

def method
  @method
end

Instance Method Details

#<=>(other) ⇒ Object



207
208
209
# File 'lib/utils/irb.rb', line 207

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

#arityObject



199
200
201
# File 'lib/utils/irb.rb', line 199

def arity
  method.arity
end

#ownerObject



195
196
197
# File 'lib/utils/irb.rb', line 195

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

#source_locationObject



203
204
205
# File 'lib/utils/irb.rb', line 203

def source_location
  method.source_location
end