attributes_sanitizer 0.1.0 → 0.1.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.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/attributes_sanitizer/predefined.rb +4 -1
- data/lib/attributes_sanitizer/version.rb +1 -1
- 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: 12b4709383dbae4f0d6a6f345719ecffa47fe27e750d39cf00b14e788cf35536
|
4
|
+
data.tar.gz: 56fdfa609e76e3870cda762b237e234d9bbafc1904875114970a56f41de0325d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a05d6ea506b2c4d77f5d9022ebde30514d5e1de50d6ac94a974ea378efc77c52a2a08463e665b5981f6df727d5b6d179e74d42ceda14c0c07a9ba583490efbf5
|
7
|
+
data.tar.gz: 9ae866687f015fae0041fd60aee83ee96834b7033ab10c75d55366afe6a72172df9687cce35336bf9629744d3e280f91a5121110a4df6bf5c543b43d2a56bf57
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[](https://codeclimate.com/github/andersondias/attributes_sanitizer/maintainability)
|
1
|
+
[](https://codeclimate.com/github/andersondias/attributes_sanitizer/maintainability) [](https://codeclimate.com/github/andersondias/attributes_sanitizer/test_coverage)
|
2
2
|
|
3
3
|
# AttributesSanitizer
|
4
4
|
|
@@ -20,6 +20,7 @@ end
|
|
20
20
|
```
|
21
21
|
|
22
22
|
It comes with pre-defined sanitizers:
|
23
|
+
- `:stringify` which perform a `to_s` into the value, to be sanitized as a string. Can be used before other sanitizer, that depends to the value be a string
|
23
24
|
- `:downcase` which downcases a given attribute string
|
24
25
|
- `:upcase` which upcases a given attribute string
|
25
26
|
- `:strip_tags` which removes any tags from the given string based on Rails sanitize helper.
|
@@ -3,6 +3,10 @@ module AttributesSanitizer
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
+
AttributesSanitizer.define_sanitizer :stringify do |value|
|
7
|
+
value.to_s
|
8
|
+
end
|
9
|
+
|
6
10
|
AttributesSanitizer.define_sanitizer :downcase do |value|
|
7
11
|
value.downcase
|
8
12
|
end
|
@@ -25,4 +29,3 @@ module AttributesSanitizer
|
|
25
29
|
end
|
26
30
|
end
|
27
31
|
end
|
28
|
-
|