TurkishSupport
Turkish character support for some standard Ruby methods. This gem provide support for these methods:
String#upcaseString#upcase!String#downcaseString#downcase!String#capitalizeString#capitalize!String#swapcaseString#swapcase!String#casecmpArray#sortArray#sort!
Also gives you some new methods like:
String#titleizeString#titleize!
Requirements
- Ruby >= 2.0.0
- Rails >= 4.0.0
Notice: TurkishSupport uses refinements instead of monkey patching. Refinements come with Ruby 2.0.0 as a new feature and also, it is an experimental feature for now. If you want to more information about refinements, you can see the doc at http://www.ruby-doc.org/core-2.0.0/doc/syntax/refinements_rdoc.html
Installation
Add this line to your application's Gemfile:
gem 'turkish_support'
And then execute:
$ bundle
Or install it yourself as:
$ gem install turkish_support
Usage Instructions
After the installation of the gem, you should follow these steps.
- You need require it.
Note: If you are using a framework like Rails, you don't need to require, because it is already required by the framework.
require TurkishSupport
- Add
using TurkishSupportline to the top of the scope, not inside of any class or module.
using TurkishSupport
Examples
Within the file which you added using TurkishSupport line to the top of the scope; you can use core methods like below:
str = 'Bağcılar'
str.upcase #=> "BAĞCILAR"
str #=> "Bağcılar"
str = "İSMAİL"
str.downcase! #=> "ismail"
str #=> "ismail"
"merhaba".capitalize #=> "Merhaba"
["iki", "üç", "dört", "ılık", "iğne", "iyne"].sort #=> ["dört", "ılık", "iğne", "iki", "iyne", "üç"]
Note: If you also want to use original set of the core methods in the same scope, you can use send method like this:
str = 'Bağcılar'
str.send(:upcase) #=> "BAğCıLAR"
Contributing
- Fork it ( http://github.com/sbagdat/turkish_support/fork )
- 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