methods

obj.methods(all=true) â array
Instance Public methods

Returns a list of the names of public and protected methods of obj. This will include all the methods accessible in obj's ancestors. If the all parameter is set to false, only those methods in the receiver will be listed.

class Klass
  def klass_method()
  end
end
k = Klass.new
k.methods[0..9]    #=> [:klass_method, :nil?, :===,
                   #    :==~, :!, :eql?
                   #    :hash, :<=>, :class, :singleton_class]
k.methods.length   #=> 57
doc_ruby_on_rails
2015-04-23 20:29:21
Comments
Leave a Comment

Please login to continue.