Method: Pry::Method#aliases
- Defined in:
- lib/pry/method.rb
#aliases ⇒ Array<String>
Returns All known aliases for the method.
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/pry/method.rb', line 461 def aliases owner = @method.owner # Avoid using `to_sym` on {Method#name}, which returns a `String`, because # it won't be garbage collected. name = @method.name all_methods_to_compare = owner.instance_methods | owner.private_instance_methods alias_list = all_methods_to_compare.combination(2).select do |pair| pair.include?(name) && owner.instance_method(pair.first) == owner.instance_method(pair.last) end.flatten alias_list.delete(name) alias_list.map(&:to_s) end |