Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dimakura/ka
common functionality for georgian projects
https://github.com/dimakura/ka
Last synced: about 2 months ago
JSON representation
common functionality for georgian projects
- Host: GitHub
- URL: https://github.com/dimakura/ka
- Owner: dimakura
- License: mit
- Created: 2013-05-06T08:00:21.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-11-09T09:08:06.000Z (about 11 years ago)
- Last Synced: 2024-08-04T04:04:53.775Z (5 months ago)
- Language: Ruby
- Size: 133 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-georgia - dimakura/ka - Common functionality for georgian projects (Ruby). (Categories)
README
# KA: write georgian softwate with ruby
There are number of occasions when you deal with uncommon situations in georgian software.
Those are:* mobile number validation,
* numbers to readable format (1 -> 'ერთი'),
* date formatting (not supported by i18n)
* and outdated, but still active, GEO character encoding.KA gem will enable you to deal with all these situations.
## Installation
Add this line to your application's Gemfile:
gem 'ka',
And then execute:
$ bundle
Or install it yourself as:
$ gem install ka
## Usage
### Mobile numbers
Validation and formatting of mobile numbers are self-exmplanatory:
```ruby
require 'ka'
include KA
...
mobile = 'my mobile: (595) 33 55 14'
compact_mobile(mobile) # => '595335514'
correct_mobile?(mobile) # => true
format_mobile(mobile, operator_pre: '[', operator_suf: ']', by: 2, separator: ' ') #=> [595]33 55 14
```### Number spelling
`to_ka` method is integrated within `Integer` class.
Now you can convert integers into georgian words (works upto 999,999,999,999,999).This task is common, especialy when writing some accounting software.
```ruby
1.to_ka # => ერთი
999_999_999_999_999.to_ka # => ცხრაას ოთხმოცდა ცხრამეტი ტრილიონ ცხრაას ოთხმოცდა ცხრამეტი მილიარდ ცხრაას ოთხმოცდა ცხრამეტი მილიონ ცხრაას ოთხმოცდა ცხრამეტი ათას ცხრაას ოთხმოცდა ცხრამეტი
```### Date formats
TODO:
### GEO character encoding
When using the `ka` gem `String` automatically receives the `to_ka`, `to_geo` and `to_lat` methods.
```ruby
'dimitri'.to_ka(:all) # => დიმიტრი
'დიმიტრი'.to_lat # => dimitri
'დიმიტრი'.to_geo # => ÃÉÌÉÔÒÉ
```The `to_ka` method receives the additional `type` parameter which indicates which characters
to use when converting to georgian unicode. There are three possible values for this parameter:* `geo`, convert only GEO characters (default),
* `lat`, convert only LAT characters and
* `all`, converts both GEO and LAT characters.## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request