drexed-validators 0.0.11 → 0.0.12

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: 8f855d819073cb7caa88516343b5b926b4a76a9a
4
- data.tar.gz: 384172213c562cb9a9d0b33bbf72d1f878ad912f
3
+ metadata.gz: e04253c9e757257d1102c07b807fdf28cc6d8e1d
4
+ data.tar.gz: 2f5da6b47ff1f7ea3b00b3658ca3e98efddd6056
5
5
  SHA512:
6
- metadata.gz: 939844cdc6f99729f6a4d4d98f725d558174b05862d77a884858ec59d127fcf3cdd4f43313888c17c17be21213590a34db9a0b23628f9d0d131077e5a209199c
7
- data.tar.gz: c1088dbde0b6cc4a78733dde858bedd31981d8b1315b109cde96a5afc39e022a39f66c4bf44505732d5e23f78f90ec5b6b3f5b0e46eadd507eff0e0cc0bbe446
6
+ metadata.gz: adae22c7dd4ebd7d54ec86993268abd865072f0085d6098fca1b961f74ed01bc55bbd71729d3e260708efe19c26ce943387151739bb202d09c5a7f52da73feb2
7
+ data.tar.gz: 2ed443ad4cd5c1ab26e02a02837e3730b2a13eea996a96e04180e37e8d28b604174cb30dd447cf8af3236ef52306d31c5090c571b34a40cfa7ffc3ec3f872927
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Validate commonly used attributes easily with drexed-validators.
4
4
 
5
- Currently supported validators: currency, email, file_size, hex, HTML, IP, name, password, phone, slug, ssn, url, username, and zipcode
5
+ Currently supported validators: currency, email, file_size, hex, HTML, IP, name, password, phone, postal code, slug, ssn, url, and username.
6
6
 
7
7
  ## Installation
8
8
 
@@ -1,4 +1,4 @@
1
- class ZipcodeValidator < ActiveModel::EachValidator
1
+ class PostalCodeValidator < ActiveModel::EachValidator
2
2
  def validate_each(object, attribute, value)
3
3
  unless value =~ /^\A[\d]{5}(?:[-|\s][\d]{4})?\Z$/
4
4
  object.errors[attribute] << (options[:message] || "is not formatted properly")
@@ -1,7 +1,7 @@
1
1
  class TelephoneValidator < ActiveModel::EachValidator
2
2
  def validate_each(object, attribute, value)
3
3
  formatted_value = value.gsub(/[\s\.\+\(\)-]*/, "")
4
- is_number = !(formatted_value =~ /^[-+]?[0-9]+$/).nil?
4
+ is_number = !(formatted_value =~ /^[0-9+\(\)#\.\s\/ext-]+$/).nil?
5
5
  unless is_number && validate_by_region(options[:region], formatted_value)
6
6
  object.errors[attribute] << (options[:message] || "is not formatted properly")
7
7
  end
@@ -1,5 +1,5 @@
1
1
  module Drexed
2
2
  module Validators
3
- VERSION = "0.0.11"
3
+ VERSION = "0.0.12"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drexed-validators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-08 00:00:00.000000000 Z
11
+ date: 2014-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -58,12 +58,12 @@ files:
58
58
  - app/validators/ip_validator.rb
59
59
  - app/validators/name_validator.rb
60
60
  - app/validators/password_validator.rb
61
+ - app/validators/postal_code_validator.rb
61
62
  - app/validators/slug_validator.rb
62
63
  - app/validators/ssn_validator.rb
63
64
  - app/validators/telephone_validator.rb
64
65
  - app/validators/url_validator.rb
65
66
  - app/validators/username_validator.rb
66
- - app/validators/zipcode_validator.rb
67
67
  - drexed-validators.gemspec
68
68
  - lib/drexed/validators.rb
69
69
  - lib/drexed/validators/version.rb