validators 2.7.0 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -9
  3. data/bin/sync-disposable-hostnames +6 -6
  4. data/bin/sync-tld +4 -4
  5. data/data/disposable.json +8272 -2
  6. data/data/tld.json +0 -1
  7. data/lib/validators/constants.rb +1 -0
  8. data/lib/validators/hostname.rb +1 -1
  9. data/lib/validators/validates_cnpj_format_of.rb +2 -1
  10. data/lib/validators/validates_cpf_format_of.rb +2 -1
  11. data/lib/validators/validates_datetime.rb +29 -18
  12. data/lib/validators/validates_email_format_of.rb +19 -13
  13. data/lib/validators/validates_ip_address.rb +13 -9
  14. data/lib/validators/validates_ownership_of.rb +11 -9
  15. data/lib/validators/validates_ssh_private_key.rb +15 -7
  16. data/lib/validators/validates_ssh_public_key.rb +5 -2
  17. data/lib/validators/validates_url_format_of.rb +5 -3
  18. data/lib/validators/version.rb +2 -2
  19. data/test/schema.rb +1 -1
  20. data/test/support/emails.rb +37 -27
  21. data/test/support/models.rb +1 -1
  22. data/test/support/urls.rb +28 -28
  23. data/test/validators/validates_datetime/after_option_test.rb +5 -5
  24. data/test/validators/validates_datetime/before_option_test.rb +2 -2
  25. data/test/validators/validates_datetime/defaults_test.rb +1 -1
  26. data/test/validators/validates_email_format_of_test.rb +11 -11
  27. data/test/validators/validates_ip_address/ipv4_test.rb +2 -2
  28. data/test/validators/validates_ip_address/ipv6_test.rb +2 -2
  29. data/test/validators/validates_ip_address_test.rb +2 -2
  30. data/test/validators/validates_ownership_of_test.rb +5 -5
  31. data/test/validators/validates_ssh_private_key/dsa_test.rb +2 -2
  32. data/test/validators/validates_ssh_private_key/rsa_test.rb +1 -1
  33. data/test/validators/validates_url_format_of/with_tld_validation_test.rb +1 -1
  34. data/test/validators/validates_url_format_of/without_tld_validation_test.rb +7 -7
  35. data/validators.gemspec +2 -2
  36. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e99b7605fc17bcaa3e6c2e0fdf5a757c67666c51ed7ef6e5591751f5778b90f
4
- data.tar.gz: 3704bc44affb18e79ca86f242d361d524e6ccae5366fb942b43ab7253150aa9c
3
+ metadata.gz: ca3a7326669a28e5030b94ee05a28319992344298c08db969acec22218ef9dcb
4
+ data.tar.gz: 1507f0cce162f06a5a2d07cfe8b38f8ae2e562b309ce06818af142f1eb544f71
5
5
  SHA512:
6
- metadata.gz: 8364228c0a8cec7a19c60cc5f7cedb481b99b85830a306591e3b3926187e464631f6c591fb0ac9fc62e2f37b0d4050b03bfdbc810f81fcd3f515d02fc93570d9
7
- data.tar.gz: 789fc128f07f0106a82744da08b7aa96ece3b6f25f0ddcd0656810c4a4d55359d4cadbccf11fa300268f5343e32ff1742f5ee628021a3b8e6f73aae8769e3ba4
6
+ metadata.gz: 959bfdeb54af37788694558d2132cce3b76a3ee6ef7998856c36fa989efc06c1a1615e3e5faef6aaba2df7af29bc00245dcb6f170bb4afb988b0c8f66d275baf
7
+ data.tar.gz: a2f238aa20d5f37ec90e54545035919913cdb673b4e207bf389ea9f529762cf050af1f711f772a370858f71f70b823a2bc7a7ee4f73735989db8b174554c9280
data/README.md CHANGED
@@ -67,7 +67,7 @@ class Task < ActiveRecord::Base
67
67
  belongs_to :user
68
68
  belongs_to :category
69
69
 
70
- validates_ownership_of :category, :with => :user
70
+ validates_ownership_of :category, with: :user
71
71
  end
72
72
 
73
73
  user = User.find(1)
@@ -76,11 +76,11 @@ another_user = User.find(2)
76
76
  user_category = user.categories.first
77
77
  another_user_category = another_user.categories.first
78
78
 
79
- task = user.tasks.create(:category => user_category)
79
+ task = user.tasks.create(category: user_category)
80
80
  task.valid?
81
81
  #=> true
82
82
 
83
- task = user.tasks.create(:category => another_user_category)
83
+ task = user.tasks.create(category: another_user_category)
84
84
  task.valid?
85
85
  #=> false
86
86
  ```
@@ -90,8 +90,8 @@ task.valid?
90
90
  ```ruby
91
91
  class Server < ActiveRecord::Base
92
92
  validates_ip_address :address
93
- validates_ip_address :address, :only => :v4
94
- validates_ip_address :address, :only => :v6
93
+ validates_ip_address :address, only: :v4
94
+ validates_ip_address :address, only: :v6
95
95
  end
96
96
  ```
97
97
 
@@ -100,11 +100,11 @@ end
100
100
  ```ruby
101
101
  class Server < ActiveRecord::Base
102
102
  validates_datetime :starts_at
103
- validates_datetime :ends_at, :after => :starts_at, :if => :starts_at?
104
- validates_datetime :ends_at, :after => :now
105
- validates_datetime :ends_at, :before => :today
103
+ validates_datetime :ends_at, after: :starts_at, if: :starts_at?
104
+ validates_datetime :ends_at, after: :now
105
+ validates_datetime :ends_at, before: :today
106
106
 
107
- validates :starts_at, :datetime => true
107
+ validates :starts_at, datetime: true
108
108
  end
109
109
  ```
110
110
 
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'open-uri'
4
- require 'json'
3
+ require "open-uri"
4
+ require "json"
5
5
 
6
- domains = JSON.load(open('https://raw.githubusercontent.com/ivolo/disposable-email-domains/master/index.json').read)
7
- domains += JSON.load(open('https://raw.githubusercontent.com/andreis/disposable-email-domains/master/domains.json').read)
8
- domains += JSON.load(open('https://raw.githubusercontent.com/FGRibreau/mailchecker/master/list.json').read).flatten
6
+ domains = JSON.load(open("https://raw.githubusercontent.com/ivolo/disposable-email-domains/master/index.json").read)
7
+ domains += JSON.load(open("https://raw.githubusercontent.com/andreis/disposable-email-domains/master/domains.json").read)
8
+ domains += JSON.load(open("https://raw.githubusercontent.com/FGRibreau/mailchecker/master/list.json").read).flatten
9
9
 
10
10
  domains.map!(&:downcase)
11
11
  domains.uniq!
12
12
  domains.sort!
13
13
 
14
- File.open('./data/disposable.json', 'w') do |file|
14
+ File.open("./data/disposable.json", "w") do |file|
15
15
  file << JSON.pretty_generate(domains)
16
16
  end
data/bin/sync-tld CHANGED
@@ -1,9 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'open-uri'
4
- require 'json'
3
+ require "open-uri"
4
+ require "json"
5
5
 
6
- tlds = open('https://data.iana.org/TLD/tlds-alpha-by-domain.txt').read.lines
6
+ tlds = open("https://data.iana.org/TLD/tlds-alpha-by-domain.txt").read.lines
7
7
  tlds.shift # remove update notice
8
8
 
9
9
  tlds.map!(&:downcase)
@@ -11,6 +11,6 @@ tlds.map!(&:strip)
11
11
  tlds.sort!
12
12
  tlds.uniq!
13
13
 
14
- File.open('./data/tld.json', 'w') do |file|
14
+ File.open("./data/tld.json", "w") do |file|
15
15
  file << JSON.pretty_generate(tlds)
16
16
  end