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

briskly

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

briskly

  • 0.1.4
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

briskly Build Status Code Climate

Usage:

Storing:

You can store a collection within a specific key. The data must be an array of hashes with a keyword and an optional data argument. Keyword can be an array.

Briskly.store('cities').with([
  { keyword: ['London', 'Londres'], data: { id: 10, name: London } },
  { keyword: 'Berlin', data: { id: 15, name: Berlin } },
  { keyword: 'Barcelona', data: { id: 25, name: Barcelona } }
)]
  • Elements are returned in the order they were inserted
  • Re-using the same key overrides the existing collection
Searching:

Search on collections using #on. The result is composed by an hash with the key(s) requested and the values are instances of Briskly::Element class. This object responds to #keyword and #data.

Briskly.store('cities').with([
  { keyword: ['London', 'Londres'], data: { id: 10, name: London } },
  { keyword: 'Berlin', data: { id: 15, name: Berlin } },
  { keyword: 'Barcelona', data: { id: 25, name: Barcelona } }
)]

result = Briskly.on('cities').search('lon')

result
=> { 'cities' => [ #Briskly::Element ... ]

result['cities'].first.keyword
=> 'London'

result = Briskly.on('cities').search('londres')
result['cities'].first.keyword
=> 'Londres'

Example with multiple collections

Briskly.store('cities').with([
  { keyword: 'Foo' },
  ...
)]

Briskly.store('countries').with([
  { keyword: 'Foobear' },
  ...
)]

result = Briskly.on('countries', 'cities').search('foo')

result
=> { 'cities' => [ #Briskly::Element ], 'countries' => [ #Briskly::Element ] }

Notes:

  • Search is not case sensitive
  • Results are returned only if they match beginning of word

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

License

MIT licence. Copyright (c) 2013 HouseTrip Ltd.

FAQs

Package last updated on 28 Apr 2014

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