strip_attributes 1.10.1 → 1.11.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/lib/strip_attributes.rb +1 -2
- data/lib/strip_attributes/version.rb +1 -1
- data/test/strip_attributes_test.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed9be0d24aad9365c9d797bb0f2fbbf421462a273b2d91ed5ea87c4eccee6abe
|
4
|
+
data.tar.gz: e5bf778e55185b5def4c968092830948d1cf37089f7adbd8f84783ceeabbcb35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 550b50a9bd0386a91ecb213d400be75a006603f016ef958f9e22111d800933769fabd5abd67094d607b2c4d7bc98d97b9699189125b30afc324c1ae514d140cc
|
7
|
+
data.tar.gz: 29d1fb640513e0f996928251d21e3466b96bc679ee742c7101b92cca3c3bba9233fcee7cb6c9438987ab3216cd2adff96d6581d368334d3450025d4f4981d47f
|
data/lib/strip_attributes.rb
CHANGED
@@ -52,14 +52,13 @@ module StripAttributes
|
|
52
52
|
|
53
53
|
def self.strip_string(value, options = {})
|
54
54
|
return value unless value.is_a?(String)
|
55
|
-
|
55
|
+
return value if value.frozen?
|
56
56
|
|
57
57
|
allow_empty = options[:allow_empty]
|
58
58
|
collapse_spaces = options[:collapse_spaces]
|
59
59
|
replace_newlines = options[:replace_newlines]
|
60
60
|
regex = options[:regex]
|
61
61
|
|
62
|
-
value = value.dup
|
63
62
|
value.gsub!(regex, "") if regex
|
64
63
|
|
65
64
|
if MULTIBYTE_SUPPORTED && Encoding.compatible?(value, MULTIBYTE_SPACE)
|
@@ -204,10 +204,10 @@ class StripAttributesTest < Minitest::Test
|
|
204
204
|
assert_equal "", record.bang
|
205
205
|
end
|
206
206
|
|
207
|
-
def
|
207
|
+
def test_should_skip_frozen_values
|
208
208
|
record = StripAllMockRecord.new(frozen: " ice ".freeze)
|
209
209
|
record.valid?
|
210
|
-
assert_equal "ice", record.frozen
|
210
|
+
assert_equal " ice ", record.frozen
|
211
211
|
end
|
212
212
|
|
213
213
|
def test_should_collapse_duplicate_spaces
|