On Thu, Feb 7, 2013 at 1:56 AM, Student Jr <[email protected]> wrote: > Actually, there is another reason to avoid self.method. self.method has > the security level of protected
Right! Sometimes this is used intentionally to make method calls look more like keywords - "attr_accessor" is such a case: irb(main):006:0> Module.private_instance_methods.grep /attr/ => [:attr, :attr_reader, :attr_writer, :attr_accessor] >--you can only access private methods via > self.send. Just say no. There are two ways to invoke private methods foo() self.send(:foo) Note that the second also works with other expressions than "self". Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/ -- [email protected] | https://groups.google.com/d/forum/ruby-talk-google?hl=en --- You received this message because you are subscribed to the Google Groups "ruby-talk-google" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
