strip_attributes 1.9.1 → 1.9.2
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 +2 -0
- data/lib/strip_attributes/version.rb +1 -1
- data/test/strip_attributes_test.rb +19 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1f5a0320df5a7bdf5e4b54823d4d377d90c2e42243d548d98106d462818074b
|
4
|
+
data.tar.gz: e08452bcd46e297a856dcaa16f938dcdfaa4978dcf8438e8aa0e2cb4cbf89f1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8db784d24f9d7e38fc28dce00708223964eb770d0931bcac8ce2e954ce83e74a0f6525f8dac3e01e8670c62c3ba8b8650760caa4e857d71e99fa67653157efa2
|
7
|
+
data.tar.gz: 9451bb01daefe3b3d2624dae4cc0ee010d166eb26f959fcf822fcb1a095cbc0608f9f31461b75367f210301a3b72945a94d48c5f287b4544c38e5183ce76105d
|
data/lib/strip_attributes.rb
CHANGED
@@ -61,6 +61,17 @@ class ReplaceNewLinesAndDuplicateSpaces < Tableless
|
|
61
61
|
strip_attributes replace_newlines: true, collapse_spaces: true
|
62
62
|
end
|
63
63
|
|
64
|
+
class CoexistWithOtherObjects < Tableless
|
65
|
+
attr_accessor :arr, :hsh, :str
|
66
|
+
strip_attributes
|
67
|
+
def initialize
|
68
|
+
@arr, @hsh, @str = [], {}, "foo "
|
69
|
+
end
|
70
|
+
def attributes
|
71
|
+
{arr: arr, hsh: hsh, str: str}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
64
75
|
class CoexistWithOtherValidations < Tableless
|
65
76
|
attribute :number, type: Integer
|
66
77
|
|
@@ -242,6 +253,14 @@ class StripAttributesTest < Minitest::Test
|
|
242
253
|
assert_equal "", record.bang
|
243
254
|
end
|
244
255
|
|
256
|
+
def test_should_allow_other_empty_objects
|
257
|
+
record = CoexistWithOtherObjects.new
|
258
|
+
record.valid?
|
259
|
+
assert_equal [], record.arr
|
260
|
+
assert_equal({}, record.hsh)
|
261
|
+
assert_equal "foo", record.str
|
262
|
+
end
|
263
|
+
|
245
264
|
def test_should_coexist_with_other_validations
|
246
265
|
record = CoexistWithOtherValidations.new
|
247
266
|
record.number = 1000.1
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strip_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan McGeary
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|