Inconsistent Information on Documentations Regarding Order of Operations and Contains
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
On the wiki of this Github repo, it states that:
Note that there is NO "not" operator. Also note that you CANNOT use parentheses to control order of operations, and the precedence of the operators appears to be unspecified. So when in doubt, use nested "if" statements instead of risking it.
However, in this fantastic documentation(shopify.github.io/liquid/):
In tags with more than one and or or operator, operators are checked in order from right to left. You cannot change the order of operations using parentheses — parentheses are invalid characters in Liquid and will prevent your tags from working.
It has caused some confusion. Can someone clarify which one is correct (and maybe update the incorrect one)?
Furthermore, the followings are stated in the same order:
contains— a wrapper around Ruby'sinclude?method, which is implemented on strings, arrays, and hashes. If the left argument is a string and the right isn't, it stringifies the right.
containscan only search strings. You cannot use it to check for an object in an array of objects.
I know very little about Ruby, however it also states on this doc that include?:
Returns true if the given object is present in self (that is, if any element == object), otherwise returns false.
If contains is indeed just wrapper around include?, and if I understood correctly, it should be able to check for an object in an array of objects. Am I missing something?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the wiki's Liquid for Designers if--else section with the Shopify documentation's Operators and Order of Operations section. Verify the documented order of operations and contains behavior against the project's actual behavior, then update the inconsistent documentation so both sources agree and explain whether arrays of objects are supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100