Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fusic/roshi
ActiveModel/ActiveRecord Validation Collection For Mainly Japanese
https://github.com/fusic/roshi
Last synced: about 1 month ago
JSON representation
ActiveModel/ActiveRecord Validation Collection For Mainly Japanese
- Host: GitHub
- URL: https://github.com/fusic/roshi
- Owner: fusic
- Created: 2015-08-12T09:07:18.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-10-05T13:48:12.000Z (about 2 years ago)
- Last Synced: 2024-04-24T20:28:01.986Z (8 months ago)
- Language: Ruby
- Homepage:
- Size: 51.8 KB
- Stars: 3
- Watchers: 31
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Roshi
[![Gem Version](https://badge.fury.io/rb/roshi.svg)](https://badge.fury.io/rb/roshi)
[![Build Status](https://travis-ci.org/fusic/roshi.svg)](https://travis-ci.org/fusic/roshi)ActiveModel/ActiveRecord Validation Collection For Mainly Japanese
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'roshi'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install roshi
## Usage
```ruby
class TestModel
validates :email, email: true
validates :zip_code, zip_code: true # zip_code: { hiphenation: true }
validates :phone_number, phone_number: true # phone_number: { hiphenation: true }
validates :date, date: true
validates :hiragana, hiragana: true # hiragana: { allow_space: true }
validates :katakana, katakana: true # katakana: { allow_space: true }
validates :version_number, version_number: true
validates :accept_word, available_word: { accept_words: %w(accept available) }
validates :reject_word, available_word: { reject_words: %w(reject unavailable) }
validates :large_value, numerical_comparison: { greater_than: :small_value }
validates :large_value, numerical_comparison: { greater_than_or_equal_to: :small_value }
validates :large_value, numerical_comparison: { equal_to: :small_value }
validates :small_value, numerical_comparison: { less_than_or_equal_to: :large_value }
validates :small_value, numerical_comparison: { less_than: :large_value }
validates :middle_value, numerical_comparison: { between: { min: :small_value, max: :large_value } }
end
```## Contributing
1. Fork it ( https://github.com/fusic/roshi/fork )
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 a new Pull Request