Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix /en/documentation/faq/2/index.md #2852

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Abhideveloper28
Copy link

This statement looks wrong to me, It said a A def statement outside of a class definition become private methods of class Object
that is not correct. I can call method (that define outside any class) to object of class Object.

This statement looks wrong to me, It said a `A `def` statement outside of
a class definition become private methods of class Object`
that is not correct. I can call method (that define outside any class) to object of class Object.
@Abhideveloper28 Abhideveloper28 requested a review from a team as a code owner May 24, 2022 14:36
@stomar
Copy link
Contributor

stomar commented Oct 30, 2022

The original statement seems to be correct:

irb(main):001:0> RUBY_VERSION
=> "3.1.2"
irb(main):002:0> def my_test_method; end
=> :my_test_method
irb(main):003:0> Object.public_methods.grep /my/
=> []
irb(main):004:0> Object.private_methods.grep /my/
=> [:my_test_method]
irb(main):005:0> Object.my_test_method
(irb):5:in `<main>': private method `my_test_method' called for Object:Class (NoMethodError)

Copy link
Contributor

@stomar stomar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please clarify your statement "I can call method (that define outside any class) to object of class Object" and what you did exactly.

@jcsahnwaldt
Copy link

I think this can be closed without merging. The PR is almost two years old, OP didn't respond to questions, and the current version of the text seems to be correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants