Socket
Book a DemoInstallSign in
Socket

cicu

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cicu

0.0.1
bundlerRubygems
Version published
Maintainers
1
Created
Source

Cicu

Build Status

Custom ICU rulesets for collation in ruby - requires libicu

Installation

Add this line to your application's Gemfile:

gem 'cicu'

And then execute:

$ bundle

Or install it yourself as:

$ gem install cicu

Usage

Create a ruleset

ruleset = Cicu::Ruleset.new("[normalization on] & b < a < c")

Sort an array

ary = %w( a b c ba bb bc )
sorted_ary = ruleset.sort_by { |el| ruleset.sort_key(el) }
# => "["b", "bb", "ba", "bc", "a", "c"]"

Get the sort key for a string

ruleset.sort_key("abc")
# => "*\x04)*\x05\x01\a\x01\a"

You can store sort keys in a database column to use them in ORDER BY queries. Make sure to use a column type that supports binary strings (e.g. MySQLs VARBINARY).

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

FAQs

Package last updated on 17 Nov 2016

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.