sequel-string_nilifier 1.0.0 → 1.0.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.
data/README.md
CHANGED
@@ -14,10 +14,11 @@ module Sequel
|
|
14
14
|
super
|
15
15
|
end
|
16
16
|
|
17
|
-
# Set blob columns as skipping
|
17
|
+
# Set blob columns as skipping nilifying when plugin is loaded.
|
18
18
|
def set_dataset(*)
|
19
|
-
super
|
19
|
+
res = super
|
20
20
|
set_skipped_string_nilifying_columns
|
21
|
+
res
|
21
22
|
end
|
22
23
|
|
23
24
|
# Skip nilifying for the given columns.
|
@@ -32,7 +33,7 @@ module Sequel
|
|
32
33
|
|
33
34
|
private
|
34
35
|
|
35
|
-
# Automatically skip
|
36
|
+
# Automatically skip nilifying of blob columns
|
36
37
|
def set_skipped_string_nilifying_columns
|
37
38
|
if @db_schema
|
38
39
|
blob_columns = @db_schema.map{|k,v| k if v[:type] == :blob}.compact
|
@@ -43,7 +44,7 @@ module Sequel
|
|
43
44
|
|
44
45
|
module InstanceMethods
|
45
46
|
# Strip value if it is a non-blob string and the model hasn't been set
|
46
|
-
# to skip
|
47
|
+
# to skip nilifying for the column, before attempting to assign
|
47
48
|
# it to the model's values.
|
48
49
|
def nil_string?(k,str)
|
49
50
|
str.is_a?(String) && !str.is_a?(SQL::Blob) && str.strip.empty? && !model.skip_string_nilifying?(k)
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: sequel-string_nilifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jonathan Tron
|
@@ -92,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
segments:
|
94
94
|
- 0
|
95
|
-
hash:
|
95
|
+
hash: -1606853858529528596
|
96
96
|
version: '0'
|
97
97
|
none: false
|
98
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
segments:
|
103
103
|
- 0
|
104
|
-
hash:
|
104
|
+
hash: -1606853858529528596
|
105
105
|
version: '0'
|
106
106
|
none: false
|
107
107
|
requirements: []
|