On 3/29/06, ts [email protected] wrote:
public singleton method
moulon% ruby -e ‘module M def f() end; module_function :f end; p
M.singleton_methods’
[“f”]
moulon%
Guy Decoux
I knew I was wrong all the time, ty for showing me
here we go
irb(main):015:0> Kernel.private_instance_methods
=> [“gets”, “catch”, “String”, “`”, “sleep”, “getc”, “warn”, “gsub!”,
“iterator?”, “sprintf”, “remove_instance_variable”, “Integer”, “split”,
“putc”, “abort”, “chop”, “lambda”, “initialize_copy”, “srand”, “p”,
“local_variables”, “singleton_method_removed”, “printf”, “caller”,
“require”, “sub”, “eval”, “set_trace_func”, “callcc”, “binding”,
“readline”,
“throw”, “Array”, “chop!”, “syscall”, “raise”, “autoload?”, “format”,
“trace_var”, “exit!”, “block_given?”, “trap”, “Float”, “at_exit”,
“puts”,
“loop”, “sub!”, “chomp”, “system”, “singleton_method_undefined”,
“method_missing”, “scan”, “select”, “rand”, “exit”, “print”, “fork”,
“gsub”,
“exec”, “autoload”, “singleton_method_added”, “global_variables”,
“readlines”, “proc”, “fail”, “chomp!”, “open”, “untrace_var”, “test”,
“load”]
irb(main):016:0> Kernel.private_instance_methods.include?(“puts”)
=> true
Cheers
Robert
–
Deux choses sont infinies : l’univers et la bêtise humaine ; en ce qui
concerne l’univers, je n’en ai pas acquis la certitude absolue.