-
Notifications
You must be signed in to change notification settings - Fork 620
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
Ruby: introduce mixin field #2478
Conversation
In the future we will introduce a function to get a parser field with a field type as key. That will be exported to parsers. This change is for avoiding the confliction in the future. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
I thought nestingLevel was not needed because we have cork. |
I didn't implement reference tags for X and Y because I'm not sure whether it is needed or not. |
Codecov Report
@@ Coverage Diff @@
## master #2478 +/- ##
==========================================
- Coverage 86.73% 86.60% -0.14%
==========================================
Files 177 177
Lines 36621 36759 +138
==========================================
+ Hits 31764 31835 +71
- Misses 4857 4924 +67
Continue to review full report at Codecov.
|
I think I've done the right changes, but now I don't know how to push it to this branch. Maybe you need to open some "push access" for me? Not sure if it can be done on a per branch basis. Edit: Oh I just got it. I can create a PR on your fork :D Is that the right way? |
I will merge this one first. Then you can open your pull request to this repo. Before merging this, I would like to think about following case:
|
The code you given actually doesn't work on my side. A working code should look like:
class A
def hi
self.class.prepend X
p "Calling 'hi' in A."
end
end
# a = A.new
# a.hi
# => "Calling 'hi' in A."
# a.hi
# => "Calling 'hi' in X."
class A
def self.hi
self.include X
end
end
# a = A.new
# a.hi
# => (undefined method error)
# A.hi
# a.hi
# => "Calling 'hi' in X." I think we could just not bother with this, because it can actually happen anywhere: class A
end
a = A.new
# a.hi
# => (undefined method error)
# A.prepend X
# a.hi
# => "Calling 'hi' in X." |
@AmaiKinono , thank you for the explanation. I found a pattern I would like to support:
Recognizing include in the singleton method is not hard. |
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
@AmaiKinono, give me an ack if you think it is ready to merge. |
Yes I think this is ready to merge. About |
@AmaiKinono, thank you for reviewing. Feel free to ask me questions about the changes here.
I agree with you. |
See #2476.
@AmaiKinono, plesae look at 205052c. It is a test case showing how new code dealing with "include" mixin.
You may be interested in c4711e8 ..205052c.
c4711e8 and 7af2181 are preparation for 0912d1e.