validates_type 1.2.0 → 2.0.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/arguments.rb +1 -1
- data/lib/validates_type.rb +11 -11
- data/spec/activerecord/types_spec.rb +1 -1
- data/validates_type.gemspec +1 -1
- data/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8e44653a52b0fe841ec7d9141013de2f578225a
|
4
|
+
data.tar.gz: 598baddc8520cdd0f525d654c186e0f50df3c81f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c4cebb4f099167cf54c66e677ea1d27f322b1d890fd61d137b493c8a98b0553d10c622a7cebee603eb71baab352dfaeb5228f3dc3c29aa5a50b944e9dead755
|
7
|
+
data.tar.gz: bd5b8ccfdf5fd0b6dd52f826f2fa0e100f29f1230004263377084645b26bad5bdcd9674187b2e55b411968ed037ea3b820046115508d01ce94823592178ec045
|
data/Gemfile.lock
CHANGED
data/lib/arguments.rb
CHANGED
data/lib/validates_type.rb
CHANGED
@@ -16,7 +16,7 @@ module ActiveModel
|
|
16
16
|
# return: result of ActiveModel::Validations::EachValidator initialize
|
17
17
|
def initialize(options)
|
18
18
|
merged_options = {
|
19
|
-
:
|
19
|
+
message: "is expected to be a #{ type_class(options[:type]) } and is not."
|
20
20
|
}.merge(options)
|
21
21
|
|
22
22
|
super(merged_options)
|
@@ -98,16 +98,16 @@ module ActiveModel
|
|
98
98
|
# return: class constant of supported types or raises UnsupportedType
|
99
99
|
def symbol_class(symbol)
|
100
100
|
{
|
101
|
-
:
|
102
|
-
:
|
103
|
-
:
|
104
|
-
:
|
105
|
-
:
|
106
|
-
:
|
107
|
-
:
|
108
|
-
:
|
109
|
-
:
|
110
|
-
:
|
101
|
+
array: Array,
|
102
|
+
boolean: Boolean,
|
103
|
+
float: Float,
|
104
|
+
hash: Hash,
|
105
|
+
integer: Integer,
|
106
|
+
string: String,
|
107
|
+
symbol: Symbol,
|
108
|
+
time: Time,
|
109
|
+
date: Date,
|
110
|
+
big_decimal: BigDecimal,
|
111
111
|
}[symbol] || fail(ValidatesType::UnsupportedType,
|
112
112
|
"Unsupported type #{ symbol.to_s.camelize } given for validates_type.")
|
113
113
|
end
|
@@ -135,7 +135,7 @@ describe 'ValidatesType' do
|
|
135
135
|
subject { TypeValidationTest.set_accessor_and_long_validator(:hash) }
|
136
136
|
|
137
137
|
context 'field value is a Hash' do
|
138
|
-
let(:value) { { :
|
138
|
+
let(:value) { { this: :here } }
|
139
139
|
|
140
140
|
specify do
|
141
141
|
expect(subject).to be_valid
|
data/validates_type.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.files = `git ls-files`.split("\n")
|
17
17
|
s.test_files = s.files.grep(/^spec\//)
|
18
18
|
|
19
|
-
s.required_ruby_version = '>= 1.
|
19
|
+
s.required_ruby_version = '>= 1.9.3'
|
20
20
|
|
21
21
|
s.add_dependency 'ruby-boolean', '>= 1.0.0'
|
22
22
|
s.add_dependency 'activemodel', '>= 3.0.0'
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: validates_type
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jake Yesbeck
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-boolean
|
@@ -163,7 +163,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
163
|
requirements:
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
|
-
version: 1.
|
166
|
+
version: 1.9.3
|
167
167
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
168
|
requirements:
|
169
169
|
- - ">="
|