validate_as_url 0.0.7 → 0.0.9

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.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- validate_as_url (0.0.7)
4
+ validate_as_url (0.0.9)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -34,23 +34,23 @@ module ActiveRecord
34
34
  #end
35
35
 
36
36
 
37
- #if opts[:allow_nil] == false
38
- # if url.nil?
39
- # record.errors.add(attribute, :nil)
40
- # return
41
- # end
42
- #end
43
- #
44
- #url = url.to_s.strip
45
- #
46
- #if opts[:allow_blank] == false
47
- # if url.blank?
48
- # record.errors.add(attribute, :blank)
49
- # return
50
- # end
51
- #end
37
+ if options[:allow_nil] == false
38
+ if value.nil?
39
+ record.errors.add(attribute, :nil)
40
+ return
41
+ end
42
+ end
43
+
44
+ value = value.to_s.strip
45
+
46
+ if options[:allow_blank] == false
47
+ if value.blank?
48
+ record.errors.add(attribute, :blank)
49
+ return
50
+ end
51
+ end
52
52
 
53
- unless url =~ /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
53
+ unless value =~ /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
54
54
  record.errors.add(attribute, :url_wrong_format)
55
55
  end
56
56
  end
@@ -4,7 +4,7 @@
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "validate_as_url"
7
- spec.version = '0.0.7'
7
+ spec.version = '0.0.9'
8
8
  spec.author = ["Mitrofanov Dmitry"]
9
9
  spec.email = ["mdima@it-guru.biz"]
10
10
  spec.description = %q{This Gem is Used for Validations URLs}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validate_as_url
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: