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.



151
152
153
154
155
# File 'lib/utils/irb.rb', line 151

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.



157
158
159
# File 'lib/utils/irb.rb', line 157

def method
  @method
end

Instance Method Details

#<=>(other) ⇒ Object



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

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

#arityObject



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

def arity
  method.arity
end

#ownerObject



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

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

#source_locationObject



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

def source_location
  method.source_location
end