Visitar URL original
Use JsonLogic truthiness for all and none by iamzayn19 · Pull Request #52 · bhgames/json-logic-ruby · GitHub
Skip to content

Use JsonLogic truthiness for all and none - #52

Open
iamzayn19 wants to merge 1 commit into
bhgames:masterfrom
iamzayn19:fix-all-none-jsonlogic-truthiness
Open

iamzayn19 wants to merge 1 commit into
bhgames:masterfrom
iamzayn19:fix-all-none-jsonlogic-truthiness

Conversation

@iamzayn19

Copy link
Copy Markdown
Contributor

Summary

some and filter already evaluate iterator predicates with JsonLogic truthiness, but all and none were using Ruby's native truthiness instead.

That makes values like 0, "", and [] behave incorrectly inside all/none predicates, because Ruby treats some JsonLogic-falsy values as truthy.

This updates all and none to call .truthy? on the interpolated predicate result, matching the rest of the iterator operators.

Test

  • bundle exec rake test - 299 runs, 312 assertions, 0 failures, 0 errors, 0 skips

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant