validate_as_url 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,16 +15,20 @@ module ValidateAsUrl
15
15
  allow_nil: false,
16
16
  allow_blank: false
17
17
  }
18
- opts = options.merge(default_options) {|key, old, new| old} # merge the default options into the specified options, retaining all specified options
18
+ opts = options.merge(default_options) # merge the default options into the specified options, retaining all specified options
19
19
 
20
- if opts[:allow_nil] == false && url.nil?
21
- return [ opts[:message_nil] ]
20
+ if opts[:allow_nil] == false
21
+ if url.nil?
22
+ return [ opts[:message_nil] ]
23
+ end
22
24
  end
23
25
 
24
26
  url = url.to_s.strip
25
27
 
26
- if opts[:allow_blank] && url.blank?
27
- return [ opts[:message_blank] ]
28
+ if opts[:allow_blank] == false
29
+ if url.blank?
30
+ return [ opts[:message_blank] ]
31
+ end
28
32
  end
29
33
 
30
34
  unless url =~ /^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$/ix
@@ -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.2'
7
+ spec.version = '0.0.3'
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.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: