module Pry::CodeObject::Helpers
Public Instance Methods
c_method?()
click to toggle source
# File lib/pry/code_object.rb, line 30 def c_method? real_method_object? && source_type == :c end
c_module?()
click to toggle source
@return [Boolean] `true` if this module was defined by means of the C API,
`false` if it's a Ruby module.
@note If a module defined by C was extended with a lot of methods written
in Ruby, this method would fail.
# File lib/pry/code_object.rb, line 46 def c_module? return unless is_a?(WrappedModule) method_locations = wrapped.methods(false).map do |m| wrapped.method(m).source_location end method_locations.concat( wrapped.instance_methods(false).map do |m| wrapped.instance_method(m).source_location end ) c_methods = method_locations.grep(nil).count ruby_methods = method_locations.count - c_methods c_methods > ruby_methods end
command?()
click to toggle source
# File lib/pry/code_object.rb, line 38 def command? is_a?(Module) && self <= Pry::Command end
module_with_yard_docs?()
click to toggle source
# File lib/pry/code_object.rb, line 34 def module_with_yard_docs? is_a?(WrappedModule) && yard_docs? end
real_method_object?()
click to toggle source
we need this helper as some Pry::Method
objects can wrap Procs @return [Boolean]
# File lib/pry/code_object.rb, line 26 def real_method_object? is_a?(::Method) || is_a?(::UnboundMethod) end