Skip to content

Mention that all *_methods() method accept an additional argument to ignore inherited methods #3

@GoogleCodeExporter

Description

@GoogleCodeExporter
White-listing method invocation by checking whether the method is listed by a 
*_methods() method is a common mistake. For example, public_instance_methods() 
includes all inherited methods; this includes eval, exit, instance_eval, send, 
etc. However, these *_methods() accept an additional argument which omits 
inherited methods.

class RPC

  def hello
    puts "hello world"
  end

end

RPC.public_instance_methods(false)
# => [:hello]

Original issue reported on code.google.com by postmode...@gmail.com on 21 Sep 2012 at 12:57

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions