yes, but that then makes any method declared after the 'private' string private. Which means that method declarations aren't self contained, you need to know what has gone before in the file.

so

class Foo
  def bar
    :bar
  end
private
  def baz
    :baz
  end

  def this_is_private_too
    :doh
  end
end

Simon


On Sun, 25 Apr 2010 09:49:25 +0800, Nicholas Jefferson <[email protected]> wrote:

One minor glitch that annoys me is that you can't declare a method
private in the method definition itself.

class Foo
   def bar
     :bar
   end
private
   def baz
     :baz
   end
end

foo = Foo.new
p foo.bar
p foo.baz

Thanks,

Nicholas

--
You received this message because you are subscribed to the Google Groups "Ruby or 
Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to