-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add T::Enum handler #44
Conversation
Codecov Report
@@ Coverage Diff @@
## master #44 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 2 3 +1
Lines 266 287 +21
=========================================
+ Hits 266 287 +21
Continue to review full report at Codecov.
|
6ac7bb4
to
1b93459
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will display local variable assignments inside enums
block as a constant in the yard output but I guess that's wrong usage of enums
block and therefore we are okay with it?
@KaanOzkan great catch! I think i fixed it in the latest commit, check it out. (I also checked non-enum constant assignments, e.g. |
Hearts = new | ||
Clubs = new('Clubs') | ||
diamonds_serialized_value = 'Diamonds' | ||
Diamonds = new(diamonds_serialized_value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will appear as new(diamonds_serialized_value)
in the documentation, with no other reference to diamonds_serialized_value
for clarity. I don't love that, but I can live with it. LMK if you have any thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with it either way, I don't think this case is that important since people shouldn't be adding extra logic such as local variable assignments to enums
blocks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This turns out to be consistent with YARD, if you write something pathological like:
class A
b = 1
C = b
end
so I think this is 🆗
Resolves #43
Adds a simple
![image](https://user-images.githubusercontent.com/697964/119405449-1f3ade00-bc96-11eb-8f9f-e06ed05d4264.png)
T::Enum
handler, which registers each enum as a constant. I don't love the formatting, but the content is clear enough:The collapsed view is decent though:
![image](https://user-images.githubusercontent.com/697964/119405524-3c6fac80-bc96-11eb-93bb-2badfcc083ed.png)