Jordan Callicoat wrote:
> On Dec 7, 5:33 am, Alex Young <a... / blackkettle.org> wrote:
>> >> A method and a function are the same thing. Also, check this out.
>>
>>
>> Alex
> Toplevel methods are implicitly added as private methods of class
> Object, so...
> 
> p self.private_methods.include?("foo") # => true
> 
> Regards,
> Jordan

It's true, i try this differents ways :
in irb:
>> def foo
>> puts 'test'
>> end
=> nil
>> methods.include? "foo
=> true
--------------------
in test file:
def foo()
  puts 'test'
end

puts methods.include?('foo')

=> false
---------------------
So, now with your private_methods

def foo()
  puts 'test'
end

puts private_methods.include?('foo')

=> true


Good job :)
-- 
Posted via http://www.ruby-forum.com/.