···
On Fri, Nov 11, 2011 at 2:50 AM, Fily Salas <fs_tigre@hotmail.com> wrote:
The problem I see with this (if you want to call it a problem) is that
for novice like me, there is no way to know what methods have been
inherited from the module or other classes since they are not listed
here, I could open the module or the class itself, but how do you know
what methods have been inherited to other classes.
------------------------------------------------------------------------------
= Includes:
Enumerable (from ruby core)
(from ruby core)
------------------------------------------------------------------------------
Arrays are ordered, integer-indexed collections of any object. Array indexing
starts at 0, as in C or Java. A negative index is assumed to be relative to
=> true
irb(main):041:0> Array.methods.grep /methods/
=> [:instance_methods, :public_instance_methods,
:protected_instance_methods, :private_instance_methods, :methods,
:singleton_methods, :protected_methods, :private_methods,
:public_methods]
irb(main):052:0> system "ri instance_methods | head"
= .instance_methods
(from ruby core)
=== Implementation from Module
------------------------------------------------------------------------------
mod.instance_methods(include_super=true) -> array
------------------------------------------------------------------------------
=> true
irb(main):054:0> Array.instance_methods
=> [:inspect, :to_s, :to_a, :to_ary, :frozen?, :==, :eql?, :hash, :,
:=, :at, :fetch, :first, :last, :concat, :<<, :push, :pop, :shift,
:unshift, :insert, :each, :each_index, :reverse_each, :length, :size,
:empty?, :find_index, :index, :rindex, :join, :reverse, :reverse!,
:rotate, :rotate!, :sort, :sort!, :sort_by........ <snipped>
irb(main):061:0> (Array.instance_methods - Array.instance_methods(false) ).sort
=> [:!, :!=, :!~, :===, :=~, :__id__, :__send__, :all?, :any?, :chunk,
:class, :clone, :collect_concat, :define_singleton_method, :detect,
:display, :dup, :each_cons, :each_entry, :each_slice,
:each_with_index, :each_with_object, :entries, :enum_for, :equal?,
:extend, :find, :find_all, :flat_map, :freeze, :grep, :group_by,
:initialize_clone, :initialize_dup, :inject, :instance_eval,
:instance_exec, :instance_of?, :instance_variable_defined?,
:instance_variable_get, :instance_variable_set, :instance_variables,
:is_a?, :kind_of?, :max, :max_by, :member?, .......<snipped>