format_url 0.0.3 → 0.0.4

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: 1a072476a63d9b9c31ebc187d95e2439a99ecdfa
4
- data.tar.gz: d54c57861929e45c0f42e082ce28635c6b708e5d
3
+ metadata.gz: 49045f22f1b4dc6c38f7780afaccc6739a9e1d71
4
+ data.tar.gz: 89c09e88c6bf952c9b7cdbd48b07dc0cd42f0ccf
5
5
  SHA512:
6
- metadata.gz: 3974c69b58526ed3368687819b486cdf0e6c4a582977d04ff801d80d2e75d9e323b3d451bcb02a76a057f44e1aea2d3504be0265a896975115b51abe062ab60d
7
- data.tar.gz: d106c53071f988a03fb4c54b84e7ee31329939ed45aedb3e3bd2dce3fe443e942d6d87925b794048bda06db71c2fd09d0a1f73839d1b32e0dd75620edb6c9ec0
6
+ metadata.gz: 997471c35942b28521716950e9c747b058d4b7e454d6cbb4e3f819544abe11fc2ec55732a9fd109e7dbff56d7212604ed9809910f8622f894eda70c2a35ea9f5
7
+ data.tar.gz: 1a2b2c53a816c8c1a5b7fb05c12a139b21e60659b4b11dcbe8fd0ce998eac10b7e2918b472c4ff8a3d844d26fc196524ac5830845122770b963233387daca159
@@ -1,3 +1,11 @@
1
+ ## 0.0.4
2
+
3
+ * Fixed schoolboy error - only validate when we actually have some data!
4
+
5
+ ## 0.0.3
6
+
7
+ * Fixed regular expression again
8
+
1
9
  ## 0.0.2
2
10
 
3
11
  * Fixed regular expression so it plays nice with rails 4
@@ -4,7 +4,7 @@ require "format_url/railtie" if defined? Rails
4
4
 
5
5
  module FormatUrl
6
6
  def self.format_url(url)
7
- if url.to_s !~ url_regexp && "http://#{url}" =~ url_regexp
7
+ if url && url.length > 0 && url.to_s !~ url_regexp && "http://#{url}" =~ url_regexp
8
8
  "http://#{url}"
9
9
  else
10
10
  url
@@ -3,8 +3,8 @@ module FormatUrl
3
3
  def format_url(attribute)
4
4
  before_validation do
5
5
  send("#{attribute}=", FormatUrl.format_url(send(attribute)))
6
- end
7
- validates_format_of attribute, with: FormatUrl.url_regexp, message: "is not a valid URL"
6
+ end if attribute
7
+ validates_format_of attribute, with: FormatUrl.url_regexp, message: "is not a valid URL", :allow_blank => true
8
8
  end
9
9
  end
10
10
  end
@@ -1,3 +1,3 @@
1
1
  module FormatUrl
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: format_url
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Hopkinson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-26 00:00:00.000000000 Z
11
+ date: 2014-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec