active_stripper 1.0.1 → 1.1.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/active_stripper/helpers.rb +26 -0
- data/lib/active_stripper/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3b55c9e2169217183f2b5b2de205ca388ed2a1b
|
4
|
+
data.tar.gz: f9f52509ffb9bc4f4ee88efb6bcd46b03644c153
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fec625c68815ea1b2521d933b262b37c22a4a78639742603a027335d7edfbd6f1fca8a0c2b966eb37da7e24e0974ae872e9c8f84a5cd797f9b6ce4af756b627e
|
7
|
+
data.tar.gz: 83327aff77fda0dfbf1f0ae96043b832254dddd94677bd2d93bd186bad02ead76a50f4b3d509d6494b95255ff73eefd52f8fcc43c01a0be88b0bf84466bc5ce4
|
@@ -66,6 +66,32 @@ module ActiveStripper
|
|
66
66
|
return val.downcase
|
67
67
|
end
|
68
68
|
|
69
|
+
#
|
70
|
+
# Execute String#tr on `val`, find `pattern` and replace with `replacements`
|
71
|
+
#
|
72
|
+
# @param [String] val String to clean up
|
73
|
+
# @param [String] pattern First parameters to method String#tr
|
74
|
+
# @param [String] replacements Second parameters to method String#tr
|
75
|
+
#
|
76
|
+
# @return [String] Cleaned up string
|
77
|
+
#
|
78
|
+
def replace_stripper(val, pattern, replacements)
|
79
|
+
return val.tr(pattern, replacements)
|
80
|
+
end
|
81
|
+
|
82
|
+
#
|
83
|
+
# Execute String#gsub on `val`, find `pattern` and replace with `replacement`
|
84
|
+
#
|
85
|
+
# @param [String] val String to clean up
|
86
|
+
# @param [String] pattern First parameters to method String#gsub
|
87
|
+
# @param [String] replacement Second parameters to method String#gsub
|
88
|
+
#
|
89
|
+
# @return [String] Cleaned up string
|
90
|
+
#
|
91
|
+
def substitute_stripper(val, pattern, replacement)
|
92
|
+
return val.gsub(pattern, replacement)
|
93
|
+
end
|
94
|
+
|
69
95
|
#
|
70
96
|
# Set value to nil if val is an empty string
|
71
97
|
#
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_stripper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- François TCHENG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -87,9 +87,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
89
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.4.
|
90
|
+
rubygems_version: 2.4.6
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|
93
93
|
summary: Strip or preprocess Active Record / Object attributes with prepended setter
|
94
94
|
test_files: []
|
95
|
-
has_rdoc:
|