nullify_empty 0.1.2 → 0.1.3
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/lib/nullify_empty/active_record_extension.rb +3 -0
- data/lib/nullify_empty/types.rb +5 -5
- data/lib/nullify_empty/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: b93d71b3a4e195aa148e11322720e1f214a69e66
|
4
|
+
data.tar.gz: bf086d72770a6524c24952a6e2743e3f0ff75872
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8036a803f7d1b8f63ea6cb823aff3d130fda48a2e51b991df67186a25b7e99ed137ce650a78df8c4dc7a4c77a0ecddba96c9f485d4f8caae8dea0b9ba227b2f1
|
7
|
+
data.tar.gz: 0ee43fd8ba4d6abfd435be2aac3199a78abb1f940c7fb66f2f736dc131caf71bb2440ae6e5f0d8bd7ce2a915573381e6adda960b03301c82bad9221d5886d05b
|
data/lib/nullify_empty/types.rb
CHANGED
@@ -2,15 +2,15 @@ module NullifyEmpty
|
|
2
2
|
class NullifyEmptyStringType < ActiveRecord::Type::String; end
|
3
3
|
class NullifyEmptyTextType < ActiveRecord::Type::Text; end
|
4
4
|
|
5
|
-
NULLIFY_EMPTY_TYPES = {nullify_empty_string: NullifyEmptyStringType,
|
6
|
-
nullify_empty_text: NullifyEmptyTextType}
|
7
|
-
|
5
|
+
NULLIFY_EMPTY_TYPES = {nullify_empty_string: NullifyEmptyStringType,
|
6
|
+
nullify_empty_text: NullifyEmptyTextType}.freeze
|
7
|
+
|
8
8
|
NULLIFY_EMPTY_TYPES.values.each do |klass|
|
9
9
|
klass.class_eval do
|
10
10
|
def cast(value)
|
11
11
|
value = nil if value.respond_to?(:empty?) && value.empty?
|
12
12
|
super value
|
13
|
-
end
|
13
|
+
end
|
14
14
|
end
|
15
|
-
end
|
15
|
+
end
|
16
16
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nullify_empty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Chumakov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
111
|
rubyforge_project:
|
112
|
-
rubygems_version: 2.6.
|
112
|
+
rubygems_version: 2.6.13
|
113
113
|
signing_key:
|
114
114
|
specification_version: 4
|
115
115
|
summary: Store empty values as NULL in DB.
|