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.


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

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


185
186
187
# File 'lib/utils/irb.rb', line 185

def method
  @method
end

Instance Method Details

#<=>(other) ⇒ Object


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

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

#arityObject


191
192
193
# File 'lib/utils/irb.rb', line 191

def arity
  method.arity
end

#ownerObject


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

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

#source_locationObject


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

def source_location
  method.source_location
end