Module: Pry::MethodInfo
- Defined in:
- lib/pry-doc/pry_ext/method_info.rb
Class Method Summary collapse
-
.aliases(meth) ⇒ Array<UnboundMethod>
Retrieves aliases of the given method.
-
.gem_root(dir) ⇒ String
FIXME: this is unnecessarily limited to ext/ and lib/ directories.
-
.info_for(meth) ⇒ YARD::CodeObjects::MethodObject
Retrieve the YARD object that contains the method data.
Class Method Details
.aliases(meth) ⇒ Array<UnboundMethod>
Retrieves aliases of the given method.
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/pry-doc/pry_ext/method_info.rb', line 22 def aliases(meth) owner = meth.owner name = meth.name (owner.instance_methods + owner.private_instance_methods).uniq.map do |m| aliased_method = owner.__send__(:instance_method, m) next unless aliased_method == owner.__send__(:instance_method, name) next if m == name aliased_method end.compact! end |
.gem_root(dir) ⇒ String
FIXME: this is unnecessarily limited to ext/ and lib/ directories.
39 40 41 42 |
# File 'lib/pry-doc/pry_ext/method_info.rb', line 39 def gem_root(dir) return unless (index = dir.rindex(%r(/(?:lib|ext)(?:/|$)))) dir[0..index-1] end |
.info_for(meth) ⇒ YARD::CodeObjects::MethodObject
Retrieve the YARD object that contains the method data.
11 12 13 14 |
# File 'lib/pry-doc/pry_ext/method_info.rb', line 11 def info_for(meth) cache(meth) registry_lookup(meth) end |