Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/carpodaster/normalizacion
Let String instances be conviently normalized
https://github.com/carpodaster/normalizacion
Last synced: about 2 months ago
JSON representation
Let String instances be conviently normalized
- Host: GitHub
- URL: https://github.com/carpodaster/normalizacion
- Owner: carpodaster
- License: bsd-3-clause
- Created: 2010-09-17T15:13:00.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2016-05-07T07:53:49.000Z (over 8 years ago)
- Last Synced: 2024-10-29T04:08:00.566Z (3 months ago)
- Language: Ruby
- Homepage:
- Size: 25.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Normalizacion [![Build Status](https://travis-ci.org/carpodaster/normalizacion.svg?branch=master)](https://travis-ci.org/carpodaster/normalizacion)
This gem provides a [Refinement](http://ruby-doc.org/core-2.1.1/doc/syntax/refinements_rdoc.html) for the `String` class. It adds `String#normalize` which transliterates non-ASCII characters using a static collation table. It also replaces whitespaces with `-` and optionally downcases the string value.
It is very similar to what `ActiveSupport`'s `#parameterize` does, only more customizable (and without depending on ActiveSupport).
## Installation
Add this line to your application's Gemfile:
gem 'normalizacion'
And then execute:
$ bundle
Or install it yourself as:
$ gem install normalizacion
## Usage
```ruby
class YourClass
using Normalizaciondef to_s
"Schöneberger Straße"
end
endYourClass.new.to_s # => "Schoenberger-Strasse"
```## .plan
* support custom collation hash
* support more special chars by default
* handle punctuation marks## Changelog
### v1.0.0
* Uses Ruby 2.1 idioms: Keyword Arguments and Refinments
* Renamed gem#### v0.3.0
* Added `#normalize!` for in-place normalization
* Adds downcase option### v0.2.0
* Normalization can now be customized via an options hash.---
Copyright (c) 2010-2016 Carsten Zimmermann, released under a BSD-type license