https://github.com/carpodaster/normalizacion
Let String instances be conviently normalized
https://github.com/carpodaster/normalizacion
Last synced: over 1 year 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 (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2016-05-07T07:53:49.000Z (about 10 years ago)
- Last Synced: 2025-03-03T22:53:53.814Z (over 1 year 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 [](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 Normalizacion
def to_s
"Schöneberger Straße"
end
end
YourClass.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