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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 96f2b09d4f9a2cfc7266be05fee56a50bbad6609
4
- data.tar.gz: 673294fba72c81de66be3d7a6f13b7ed4f8e9a21
2
+ SHA256:
3
+ metadata.gz: 6c31b250eb6a051f684cfce8490e53b40c676b25ab3b64c01608dab49a826c41
4
+ data.tar.gz: 14e1694eda8d975ea923d9ede54cdc631ded0e6b4218776927fdb0917832636c
5
5
  SHA512:
6
- metadata.gz: dd07de35b85f1b1211b6831d4f70e69ad2f06a5ad3790252ba167871bc4a12468127558b73007a6df0820b3d005ea5465b66b4f348fea5df181727f70995c07b
7
- data.tar.gz: b5ad9b612f018af303a5d806694078574226c395abad44fa7ff6c0d6fdba3ad4041daa74eb7a9f3c3bfc7df597f4d5f98599d14136be6bc19ece295ab0e7db95
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)}
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Roshi
2
- VERSION = '0.8.0'
2
+ VERSION = '0.8.1'
3
3
  end
@@ -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.0
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: 2016-05-26 00:00:00.000000000 Z
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.5.1
132
+ rubygems_version: 2.7.6
130
133
  signing_key:
131
134
  specification_version: 4
132
135
  summary: ActiveModel/ActiveRecord Validation Collection