[ANN] Qo (0.1.1) released


(Brandon Weaver) #1

First release of Qo, short for Query Object. It's my play at pattern
matching and fluent querying in Ruby based on a few of my posts earlier:

* https://medium.com/rubyinside/triple-equals-black-magic-d934936a6379
* https://gist.github.com/baweaver/611389c41c9005d025fb8e55448bf5f5

···

*

Git Repo: https://github.com/baweaver/qo

A few quick examples:

case ['Robert', 22]
when Qo[:*, 10..19] then 'teenager'
when Qo[:*, 20..99] then 'adult'
else 'who knows'
end

people = [
  ['Robert', 22],
  ['Roberta', 22],
  ['Foo', 42],
  ['Bar', 18]
]

people.select(&Qo[:*, 15..25]) # => [["Robert", 22], ["Roberta", 22],
["Bar", 18]]

Enjoy!

- baweaver / lemur