Roshi
ActiveModel/ActiveRecord Validation Collection For Mainly Japanese
Installation
Add this line to your application's Gemfile:
gem 'roshi'
And then execute:
$ bundle
Or install it yourself as:
$ gem install roshi
Usage
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
- Fork it ( https://github.com/fusic/roshi/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 a new Pull Request