Fix /en/documentation/faq/2/index.md#2852
Open
Abhideveloper28 wants to merge 1 commit intoruby:masterfrom
Open
Fix /en/documentation/faq/2/index.md#2852Abhideveloper28 wants to merge 1 commit intoruby:masterfrom
Abhideveloper28 wants to merge 1 commit intoruby:masterfrom
Conversation
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.
Contributor
|
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) |
stomar
requested changes
Oct 31, 2022
Contributor
stomar
left a comment
There was a problem hiding this comment.
Please clarify your statement "I can call method (that define outside any class) to object of class Object" and what you did exactly.
Contributor
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This statement looks wrong to me, It said a
Adefstatement outside of a class definition become private methods of class Objectthat is not correct. I can call method (that define outside any class) to object of class Object.