Class: Object

Inherits:
BasicObject
Defined in:
lib/ri_for/method_ri.rb,
lib/ri_for/method_ri.rb,
lib/ri_for/kernel_new_methods_list.rb

Overview

TODO add to sane [?]

Instance Method Summary collapse

Instance Method Details

#my_methods(_super = false) ⇒ Object



18
19
20
21
# File 'lib/ri_for/kernel_new_methods_list.rb', line 18

def my_methods(_super=false)
  _methods = (_super) ? self.class.superclass.new.methods : Object.methods
  (self.methods - _methods).sort
end

#ri_for(name, options = {}) ⇒ Object

currently rather verbose, but will attempt to describe all it knows about a method



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/ri_for/method_ri.rb', line 171

def ri_for name, options = {}
  if self.is_a?(Class) || self.is_a?(Module)
    # i.e. String.strip
    begin
      instance_method(name).ri(options)
    rescue NameError => e #allow for Class.instance_method_name, Module.instance_method_name
      begin
        method(name).ri(options)
      rescue NameError
        raise NameError.new("appears that this object #{self} does not have this method #{name}")
      end
    end
  else
    method(name).desc(options)
  end
end

#singleton_classObject



12
13
14
# File 'lib/ri_for/method_ri.rb', line 12

def singleton_class
  class << self; self; end
end