roshi 0.8.0 → 0.8.1
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 +5 -5
- data/README.md +1 -0
- data/lib/roshi.rb +1 -1
- data/lib/roshi/active_model/validations/katakana_validator.rb +11 -0
- data/lib/roshi/version.rb +1 -1
- data/roshi.gemspec +2 -2
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6c31b250eb6a051f684cfce8490e53b40c676b25ab3b64c01608dab49a826c41
|
4
|
+
data.tar.gz: 14e1694eda8d975ea923d9ede54cdc631ded0e6b4218776927fdb0917832636c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 973aed6806b5144511cc1336b9bbdfdb7e13c82c561399f7c1808689f339610fe9ccee1ae029a93f2e02412b44931bd2ad73242ef0c7e01e3f34414e5b040138
|
7
|
+
data.tar.gz: 5a6bfd3518e8cc65e60f9452777b6f87b4751be32f1a2a7fe9009b07b86437bbfdea5ba50bcc87c97bc5e5b9f880edc7f8baa4e4169d77276b021e1085a793df
|
data/README.md
CHANGED
@@ -30,6 +30,7 @@ class TestModel
|
|
30
30
|
validates :phone_number, phone_number: true # phone_number: { hiphenation: true }
|
31
31
|
validates :date, date: true
|
32
32
|
validates :hiragana, hiragana: true
|
33
|
+
validates :katakana, katakana: true
|
33
34
|
validates :version_number, version_number: true
|
34
35
|
validates :accept_word, available_word: {accept_words: %w(accept available)}
|
35
36
|
validates :reject_word, available_word: {reject_words: %w(reject unavailable)}
|
data/lib/roshi.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'active_model'
|
2
2
|
require 'roshi/version'
|
3
3
|
%w(
|
4
|
-
email zip_code phone_number date hiragana
|
4
|
+
email zip_code phone_number date hiragana katakana
|
5
5
|
version_number available_word numerical_comparison
|
6
6
|
).each do |validator_name|
|
7
7
|
require "roshi/active_model/validations/#{validator_name}_validator"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module ActiveModel
|
2
|
+
module Validations
|
3
|
+
class KatakanaValidator < EachValidator
|
4
|
+
def validate_each(record, attribute, value)
|
5
|
+
unless value =~ /\A[\p{katakana}ー-]*\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
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', 'Kta-M']
|
10
|
-
spec.email = ['hiro.kawasaki0311@gmail.com', 'mohri1219@gmail.com']
|
9
|
+
spec.authors = ['kawahiro311', 'Kta-M', 'nmbakfm']
|
10
|
+
spec.email = ['hiro.kawasaki0311@gmail.com', 'mohri1219@gmail.com', 'nmbakfm@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,15 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roshi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kawahiro311
|
8
8
|
- Kta-M
|
9
|
+
- nmbakfm
|
9
10
|
autorequire:
|
10
11
|
bindir: bin
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
+
date: 2018-07-12 00:00:00.000000000 Z
|
13
14
|
dependencies:
|
14
15
|
- !ruby/object:Gem::Dependency
|
15
16
|
name: activemodel
|
@@ -85,6 +86,7 @@ description: ActiveModel/ActiveRecord Validation Collection For Mainly Japanese
|
|
85
86
|
email:
|
86
87
|
- hiro.kawasaki0311@gmail.com
|
87
88
|
- mohri1219@gmail.com
|
89
|
+
- nmbakfm@gmail.com
|
88
90
|
executables: []
|
89
91
|
extensions: []
|
90
92
|
extra_rdoc_files: []
|
@@ -101,6 +103,7 @@ files:
|
|
101
103
|
- lib/roshi/active_model/validations/date_validator.rb
|
102
104
|
- lib/roshi/active_model/validations/email_validator.rb
|
103
105
|
- lib/roshi/active_model/validations/hiragana_validator.rb
|
106
|
+
- lib/roshi/active_model/validations/katakana_validator.rb
|
104
107
|
- lib/roshi/active_model/validations/numerical_comparison_validator.rb
|
105
108
|
- lib/roshi/active_model/validations/phone_number_validator.rb
|
106
109
|
- lib/roshi/active_model/validations/version_number_validator.rb
|
@@ -126,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
129
|
version: '0'
|
127
130
|
requirements: []
|
128
131
|
rubyforge_project:
|
129
|
-
rubygems_version: 2.
|
132
|
+
rubygems_version: 2.7.6
|
130
133
|
signing_key:
|
131
134
|
specification_version: 4
|
132
135
|
summary: ActiveModel/ActiveRecord Validation Collection
|