Conversation
e688bd3 to
bd50baa
Compare
|
I want a configuration option for this, like for |
|
Friendly ping @WorstOfAny |
|
@WorstOfAny another friendly reminder. |
63787ec to
5342a93
Compare
|
@AlexWayfer sorry for delay. I have added the option you want. I havent seen 'test container' checks that failed before. Tip me how to fix it pls. |
5342a93 to
6227605
Compare
No problem.
Thank you.
It's not your fault. As you can see, for example, here tests are passed, but there is a report to Codecov which failed. We have many issues with Codecov in these latter days, this one is like codecov/codecov-ruby#69 (comment) I'll try to fix it separately. |
AlexWayfer
left a comment
There was a problem hiding this comment.
Please, add documentation into README.
Should be fixed in #35. Please, rebase the branch to |
|
@WorstOfAny friendly reminder. |
|
@WorstOfAny another friendly reminder, sorry. 🙈 |
aa328d9 to
c974218
Compare
Added |
c974218 to
0809727
Compare
AlexWayfer
left a comment
There was a problem hiding this comment.
Looks good with small notes. Also, please, remember about our discussion about redefining methods.
|
I think I'll drop Ruby 2.4 in |
f3fbbc3 to
a2039b5
Compare
Done. |
|
Another friendly reminder. |
|
Yet another friendly reminder (almost 2 months since the last update). |
Yet another reminder after almost 4 month. |
a2039b5 to
62ffd96
Compare
62ffd96 to
a034894
Compare
|
I see conflicting files, can you resolve it or should I do this? |
a034894 to
2acc579
Compare
sry, didn't notice this. Resolved |
AlexWayfer
left a comment
There was a problem hiding this comment.
Thank you for returning to this PR.
| Plugin can define dataset methods for all enum values: | ||
|
|
||
| ```ruby | ||
| Item.plugin :enum_values, filter_methods: true # default is `false` |
There was a problem hiding this comment.
A small naming suggestion, we can discuss it, but this is what I saw:
You're calling them dataset methods, it's actually Dataset's methods, but you named the option filter_methods. A bit confusing, and I see no problem with dataset_methods option: I don't think that there will be other dataset methods, and it's all about enums.
What do you think?
There was a problem hiding this comment.
i can do it, but for me it's like change name of predicate_methods to instance_methods. We can't filter an instance, only collection or dataset, so that's why filter_methods was used
There was a problem hiding this comment.
i thought that dataset_methods isn't clear enough naming.
There was a problem hiding this comment.
My response (with agreement and suggestion) somwhy moved below: #26 (comment)
| Array(predicate_methods) | ||
| def process_enum_values_options | ||
| @enum_values_caching = | ||
| @enum_values_options.fetch(:caching, @enum_values_caching) |
There was a problem hiding this comment.
It fits in single line, as I see.
|
|
||
| process_enum_values_option(:filter_methods) do |field, value| | ||
| dataset.methods.include?(value.to_sym) && | ||
| warn("WARNING: Redefining method #{value}") |
There was a problem hiding this comment.
- Approach with
&&for condition very unclear, please useif/unless. - I see no reason for parentheses of
warn. - It's a pretty good idea to warn, but I suggest to make it even strict: let raise an exception! And see what will happens with users.
There was a problem hiding this comment.
- And there are should be tests for this behavior!
| end | ||
|
|
||
| process_enum_values_option(:predicate_methods) do |field, value| | ||
| define_method("#{value}?", -> { public_send(field) == value }) |
There was a problem hiding this comment.
| define_method("#{value}?", -> { public_send(field) == value }) | |
| define_method("#{value}?") { public_send(field) == value } |
But is here a really need to shorten this non-related code?
| ### Filter methods | ||
|
|
||
| Plugin can define dataset methods for all enum values: | ||
|
|
||
| ```ruby | ||
| Item.plugin :enum_values, filter_methods: true # default is `false` |
There was a problem hiding this comment.
OK, I agree, what about such changes then?
| ### Filter methods | |
| Plugin can define dataset methods for all enum values: | |
| ```ruby | |
| Item.plugin :enum_values, filter_methods: true # default is `false` | |
| ### Dataset filter methods | |
| Plugin can define dataset filter methods for all enum values: | |
| ```ruby | |
| Item.plugin :enum_values, filter_methods: true # default is `false` |
|
Do you want some help? 🙄 |
Want to have methods that will filter dataset by enum values