roshi 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b5c09922befe3b47f64bbb52bde87bca661fa84
4
- data.tar.gz: 99c3480912980df3e04b0a36549a85416b229e3e
3
+ metadata.gz: b1b243c0594115e764884a75140bb7bc99cf4b66
4
+ data.tar.gz: 1f0ac997d40fac5c327f29507e2e8ed981b3e47e
5
5
  SHA512:
6
- metadata.gz: b7dfb63e670d812cd9ec61878d10bd9a44901c46c4ca063114f9f9a7c8d69631bd8113eb9dce97d958330b823d0599849b3d858656ba3b93007b70940b1cc583
7
- data.tar.gz: 40368d0fc16e686d8cebeb24763dcf52e8c34e988f22b8490487b0cdaa1ac2f386bedc6e983139a169b3ec67723c130d808617639fac76340d4a8c7956d27cef
6
+ metadata.gz: ee13cbf189fa64f70ae5fe326ff838b7064db46b76372ebf68330971c70ae7f062833941b9b20836176dfbc5c107d7c610b3dcd4205b2e2bfd5e765cc8096685
7
+ data.tar.gz: f62ab9a5f3ac21c34f176e32dab3f59b2658820fb01644af3b6b03c3a544bd093b112186ac8ac384a86462d05c97981b7bfa4898345cdda276e60fd2f5aa39fc
data/README.md CHANGED
@@ -27,6 +27,7 @@ Or install it yourself as:
27
27
  class TestModel
28
28
  validates :email, email: true
29
29
  validates :zip_code, zip_code: true # zip_code: { hiphenation: true }
30
+ validates :hiragana, hiragana: true
30
31
  validates :version_number, version_number: true
31
32
  end
32
33
  ```
data/lib/roshi.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'active_model'
2
2
  require 'roshi/version'
3
- %w(email zip_code version_number).each do |validator_name|
3
+ %w(email zip_code hiragana version_number).each do |validator_name|
4
4
  require "roshi/active_model/validations/#{validator_name}_validator"
5
5
  end
@@ -0,0 +1,11 @@
1
+ module ActiveModel
2
+ module Validations
3
+ class HiraganaValidator < EachValidator
4
+ def validate_each(record, attribute, value)
5
+ unless value =~ /\A[\p{hiragana}ー-]*\z/i
6
+ record.errors.add(attribute, options[:message] || I18n.t('errors.messages.invalid'))
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
data/lib/roshi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Roshi
2
- VERSION = '0.3.1'
2
+ VERSION = '0.4.0'
3
3
  end
data/roshi.gemspec CHANGED
@@ -6,8 +6,8 @@ require 'roshi/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = 'roshi'
8
8
  spec.version = Roshi::VERSION
9
- spec.authors = ['kawahiro311']
10
- spec.email = ['hiro.kawasaki0311@gmail.com']
9
+ spec.authors = ['kawahiro311', 'Kta-M']
10
+ spec.email = ['hiro.kawasaki0311@gmail.com', 'mohri1219@gmail.com']
11
11
 
12
12
  spec.summary = %q{ActiveModel/ActiveRecord Validation Collection}
13
13
  spec.description = %q{ActiveModel/ActiveRecord Validation Collection For Mainly Japanese}
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roshi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kawahiro311
8
+ - Kta-M
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-11-19 00:00:00.000000000 Z
12
+ date: 2015-11-20 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: activemodel
@@ -83,6 +84,7 @@ dependencies:
83
84
  description: ActiveModel/ActiveRecord Validation Collection For Mainly Japanese
84
85
  email:
85
86
  - hiro.kawasaki0311@gmail.com
87
+ - mohri1219@gmail.com
86
88
  executables: []
87
89
  extensions: []
88
90
  extra_rdoc_files: []
@@ -95,6 +97,7 @@ files:
95
97
  - Rakefile
96
98
  - lib/roshi.rb
97
99
  - lib/roshi/active_model/validations/email_validator.rb
100
+ - lib/roshi/active_model/validations/hiragana_validator.rb
98
101
  - lib/roshi/active_model/validations/version_number_validator.rb
99
102
  - lib/roshi/active_model/validations/zip_code_validator.rb
100
103
  - lib/roshi/version.rb