strip_attributes 1.7.0 → 1.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -14
- data/lib/strip_attributes.rb +3 -2
- data/lib/strip_attributes/version.rb +1 -1
- data/test/strip_attributes_test.rb +3 -0
- 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: 911cd69ac1b20e523a98773595a73bc6565b3bf8
|
4
|
+
data.tar.gz: d1c028269597585f708da5a25010c74f1d1a2fc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 833b16931b77d3c55f291b619a23a23ac69cd9ad2d52bcaa04adb66223bb059ce3392a1da254200a63107c1694619fb0822d450c913e58da4752ae69f8896d7d
|
7
|
+
data.tar.gz: 0f084d7a1afbbfa54112c07ff46cfcc2e04950aad990f94ed3d3ed3cf6e8f1962473c3f8bcedb7029ac7bb6dd6ca3a9483c83242c98b9a4e0d9399006c89f6a8
|
data/README.md
CHANGED
@@ -10,25 +10,21 @@ options can be used to limit which attributes are stripped. Both options accept
|
|
10
10
|
a single attribute (`:only => :field`) or arrays of attributes (`:except =>
|
11
11
|
[:field1, :field2, :field3]`).
|
12
12
|
|
13
|
-
|
13
|
+
---
|
14
14
|
|
15
|
-
**
|
16
|
-
[![Gratipay](http://img.shields.io/gratipay/rmm5t.svg)][gratipay]
|
17
|
-
[![Bitcoin](http://img.shields.io/badge/bitcoin-buy%20me%20a%20coffee-brightgreen.svg)][bitcoin]
|
15
|
+
**How You Can Help**
|
18
16
|
|
19
|
-
|
20
|
-
[![
|
17
|
+
[![Square Cash](http://img.shields.io/badge/square%20cash-$rmm5t-brightgreen.svg)][square]
|
18
|
+
[![Gratipay](http://img.shields.io/gratipay/rmm5t.svg)][gratipay]
|
19
|
+
[![Book a Codementor session](http://img.shields.io/badge/codementor-book%20a%20session-orange.svg)][codementor]
|
21
20
|
|
22
|
-
|
21
|
+
If you like this project, [buy me a coffee][square], [donate via Gratipay][gratipay], or [book a session with me on Codementor][codementor].
|
23
22
|
|
24
|
-
|
25
|
-
[![Book a Codementor session](http://img.shields.io/badge/codementor-book%20a%20session-orange.svg)][codementor]
|
23
|
+
Bitcoin: `1rmm5tv6f997JK5bLcGbRCZyVjZUPkQ2m`
|
26
24
|
|
25
|
+
[square]: https://cash.me/$rmm5t "Donate to rmm5t for open source!"
|
27
26
|
[gratipay]: https://gratipay.com/rmm5t/ "Donate to rmm5t for open source!"
|
28
|
-
[bitcoin]:
|
29
|
-
[bitcoin-scheme]: bitcoin:1rmm5tv6f997JK5bLcGbRCZyVjZUPkQ2m?amount=0.01&label=Coffee%20to%20rmm5t%20for%20Open%20Source "Buy rmm5t a coffee for open source!"
|
30
|
-
[bitcoin-qr-small]: http://chart.apis.google.com/chart?cht=qr&chs=150x150&chl=bitcoin%3A1rmm5tv6f997JK5bLcGbRCZyVjZUPkQ2m%3Famount%3D0.01%26label%3DCoffee%2520to%2520rmm5t%2520for%2520Open%2520Source
|
31
|
-
[bitcoin-qr-big]: http://chart.apis.google.com/chart?cht=qr&chs=500x500&chl=bitcoin%3A1rmm5tv6f997JK5bLcGbRCZyVjZUPkQ2m%3Famount%3D0.01%26label%3DCoffee%2520to%2520rmm5t%2520for%2520Open%2520Source
|
27
|
+
[bitcoin]: bitcoin:1rmm5tv6f997JK5bLcGbRCZyVjZUPkQ2m?amount=0.01&label=Coffee%20to%20rmm5t%20for%20Open%20Source "Buy rmm5t a coffee for open source!"
|
32
28
|
[codementor]: https://www.codementor.io/rmm5t?utm_campaign=profile&utm_source=button-rmm5t&utm_medium=shields "Book a session with rmm5t on Codementor!"
|
33
29
|
|
34
30
|
## Installation
|
@@ -230,7 +226,11 @@ Wiki](http://oldwiki.rubyonrails.org/rails/pages/HowToStripWhitespaceFromModelFi
|
|
230
226
|
but was modified from the original to include more idiomatic ruby and rails
|
231
227
|
support.
|
232
228
|
|
229
|
+
## Versioning
|
230
|
+
|
231
|
+
Semantic Versioning 2.0 as defined at <http://semver.org>.
|
232
|
+
|
233
233
|
## License
|
234
234
|
|
235
|
-
Copyright (c) 2007-
|
235
|
+
Copyright (c) 2007-2015 Ryan McGeary released under the [MIT
|
236
236
|
license](http://en.wikipedia.org/wiki/MIT_License)
|
data/lib/strip_attributes.rb
CHANGED
@@ -70,8 +70,9 @@ module StripAttributes
|
|
70
70
|
# U+200D ZERO WIDTH JOINER
|
71
71
|
# U+2060 WORD JOINER
|
72
72
|
# U+FEFF ZERO WIDTH NO-BREAK SPACE
|
73
|
-
|
74
|
-
|
73
|
+
regex = /\A[[:space:]\u180E\u200B\u200C\u200D\u2060\uFEFF]+|[[:space:]\u180E\u200B\u200C\u200D\u2060\uFEFF]+\z/
|
74
|
+
if value.respond_to?(:gsub!) && Encoding.compatible?(value, regex)
|
75
|
+
value.gsub!(regex, '')
|
75
76
|
end
|
76
77
|
elsif value.respond_to?(:strip!)
|
77
78
|
value.strip!
|
@@ -267,7 +267,10 @@ class StripAttributesTest < Minitest::Test
|
|
267
267
|
return if "\u0020" != " "
|
268
268
|
# U200A - HAIR SPACE
|
269
269
|
# U200B - ZERO WIDTH SPACE
|
270
|
+
# U20AC - EURO SIGN
|
271
|
+
|
270
272
|
assert_equal "foo", StripAttributes.strip("\u200A\u200B foo\u200A\u200B ")
|
273
|
+
assert_equal "foo\u20AC".force_encoding("ASCII-8BIT"), StripAttributes.strip("foo\u20AC ".force_encoding("ASCII-8BIT"))
|
271
274
|
end
|
272
275
|
end
|
273
276
|
end
|
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.7.
|
4
|
+
version: 1.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan McGeary
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
144
|
version: '0'
|
145
145
|
requirements: []
|
146
146
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.4.
|
147
|
+
rubygems_version: 2.4.8
|
148
148
|
signing_key:
|
149
149
|
specification_version: 4
|
150
150
|
summary: Whitespace cleanup for ActiveModel attributes
|