ostruct-sanitizer 0.3.1 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2195eea12fb39af3afff6c4b6fe806ec04bca30
4
- data.tar.gz: 76c44ec8ff0b923e93adbc976a59a6683ff3892a
3
+ metadata.gz: 394b3fad1a9d90995cb53fe82963aac941605eff
4
+ data.tar.gz: 0af510883d0da26ff1e1ce4d86143e38e3452a55
5
5
  SHA512:
6
- metadata.gz: c66bb4d5415a969ee8e986c34b9363ef1971fa1e5de273617069dd69fc10384ba78567a56301bdd392fa8311404c24c8079840372174e9699dc30bad85589b67
7
- data.tar.gz: 76b3e51b2ede7292b4e065c4125c0c2ff990650445297d705690071e19c4e59b89ee82db8748fd1119bf43fbd493305cec83b6beac90c6c5bdb1828897e28e37
6
+ metadata.gz: 41dfe532cbcdc441b3da61b127568edd5d6dfd6817f281482f51a36e2f0ef0ee89676c1c78425d5caba561d73fd4b135ab3e7cd648cbd26d5ebd774faf817e19
7
+ data.tar.gz: 504c8ddc4d3a9e53775fdbbc6bd828580f4911fcfbb7ec54a49888663560bbb012fc57be0b56265f40986f9878a6f343e5c6894746dc94512fde50a42032fc78
data/README.md CHANGED
@@ -34,7 +34,7 @@ class User < OpenStruct
34
34
  include OStruct::Sanitizer
35
35
 
36
36
  truncate :first_name, :last_name, length: 10
37
- drop_punctuation :city, :country
37
+ alphanumeric :city, :country
38
38
  strip :email, :phone
39
39
 
40
40
  sanitize :age do |value|
@@ -1,5 +1,5 @@
1
1
  module OStruct
2
2
  module Sanitizer
3
- VERSION = "0.3.1"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
@@ -10,7 +10,7 @@ module OStruct
10
10
  # include WellsFargoRetail::Sanitizer
11
11
  #
12
12
  # truncate :name, length: 20
13
- # drop_punctuation :name
13
+ # alphanumeric :name
14
14
  # sanitize :middle_name do |value|
15
15
  # # Perform a more complex sanitization process
16
16
  # end
@@ -94,12 +94,12 @@ module OStruct
94
94
  strip(*fields) if strip_whitespaces
95
95
  end
96
96
 
97
- # Drops any punctuation character from the field's value
97
+ # Remove any non-alphanumeric character from the field's value
98
98
  #
99
99
  # @param [Array<Symbol>] a list of field names to be sanitized
100
100
  #
101
- def drop_punctuation(*fields)
102
- sanitize(*fields) { |value| value.gsub(/[^\w\s]/, '') }
101
+ def alphanumeric(*fields)
102
+ sanitize(*fields) { |value| value.gsub(/[^A-Za-z0-9\s]/, '') }
103
103
  end
104
104
 
105
105
  # Strips out leading and trailing spaces from the values of the given fields
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ostruct-sanitizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diego Borges
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-20 00:00:00.000000000 Z
11
+ date: 2016-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler