sequel-string_nilifier 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Sequel::StringNilifier
2
2
 
3
- Sequel plugin to convert empty string to nil
3
+ Sequel plugin to convert empty string to nil.
4
+ Adapted from `Sequel::Plugins::StringStripper` from Jeremy Evans.
4
5
 
5
6
  ## Installation
6
7
 
@@ -1,7 +1,7 @@
1
1
  module Sequel
2
2
  module Plugins
3
3
  module StringNilifier
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
6
6
  end
7
7
  end
@@ -14,10 +14,11 @@ module Sequel
14
14
  super
15
15
  end
16
16
 
17
- # Set blob columns as skipping stripping when plugin is loaded.
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 stripping of blob columns
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 stripping for the column, before attempting to assign
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.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: 289012220966116596
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: 289012220966116596
104
+ hash: -1606853858529528596
105
105
  version: '0'
106
106
  none: false
107
107
  requirements: []