Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

boolminot

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

boolminot

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Boolminot

Gem Version Build Status Coverage Status Code Climate Dependency Status

Boolminot provides composable models of Elasticsearch clauses, built on top of the Logica predicate framework.

Installation

Add this line to your application's Gemfile:

gem 'boolminot'

And then execute:

$ bundle

Or install it yourself as:

$ gem install boolminot

Usage

Here is a simple example:

has_any_color   = Boolminot.clause_factory.exists(:colors)
has_color_white = Boolminot.clause_factory.term(:colors, 'white')
has_color_red   = Boolminot.clause_factory.term(:colors, 'red')
has_color_green = Boolminot.clause_factory.term(:colors, 'green')
is_machine_washable = Boolminot.clause_factory.term(:machine, true)

has_any_color.to_elasticsearch
{ exists: { field: :colors } }

has_color_red.to_elasticsearch
{ term: { colors: 'red'} }

has_color_white.and(has_color_red).to_elasticsearch
{ bool: { must: [ { term: { colors: 'white' } }, { term: { colors: 'red' } } ] } }

has_color_white.or(has_color_red).to_elasticsearch
{ terms: { colors: ['white', 'red'] } }

has_color_white.or(is_machine_washable).to_elasticsearch
{ bool: { should: [ { term: { colors: 'white' } }, { term: { machine: true } } ] } }

has_color_green.negated.to_elasticsearch
{ bool: { must_not: [ { term: { colors: 'green' } } ] } }

More examples with other clause types can be found in the test files.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/eugeniobruno/boolminot. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 02 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc