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.



158
159
160
161
162
# File 'lib/utils/irb.rb', line 158

def initialize(obj, name, modul)
  super(name)
  @method = modul ? obj.instance_method(name) : obj.method(name)
  @description = "#{owner}##@name(#{arity})"
end

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



164
165
166
# File 'lib/utils/irb.rb', line 164

def method
  @method
end

Instance Method Details

#<=>(other) ⇒ Object



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

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

#arityObject



170
171
172
# File 'lib/utils/irb.rb', line 170

def arity
  method.arity
end

#ownerObject



166
167
168
# File 'lib/utils/irb.rb', line 166

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

#source_locationObject



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

def source_location
  method.source_location
end