url_format 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c553211f808197b8910c54132572fb2713766a27
4
- data.tar.gz: 32344bd21e3393e7df21f5ad0c745564ccebaa7c
3
+ metadata.gz: a9ab1011a61bbac549072914ab54f74cefff6ad7
4
+ data.tar.gz: 88d1ed28e9763fa531589fded708b0a311b7f844
5
5
  SHA512:
6
- metadata.gz: 6cfc469b1170baafbea1f8d729ed28d4347e61cf7db621d9e4f90456eb8f1a955bb0ccb3265191a424ccfb24f018a9df2fe4d50543c89771a0ff844cba227470
7
- data.tar.gz: a60ff9bc7200221a97eedd9f1e733724bdf4845c5f563a822d79c8f60ddb2c0a6f83109273b91be102bd610569de69c2c67eff47b4f7e77a164ae0e1f61c4151
6
+ metadata.gz: 342caa41756703d9f1578a9b622f2bcfa4b5ade5324014aed5a9cc461da80186072df13d295f9697ab398044f82183346154dd7968f0172961cc591da9b5982b
7
+ data.tar.gz: 45a42f051194e50f89c760759cbed46bd1b38dedd458202482b41c426e05241c6606ec42c85d1069a2e73ea3e2ffe2774e94881b82663da39f82adf1d5fa9a33
@@ -1,6 +1,6 @@
1
1
  class UrlFormatValidator < ActiveModel::EachValidator
2
2
  def validate_each(record, attribute, value)
3
- format_value(value)
3
+ format_value(record, attribute, value)
4
4
  unless URI.parse(value).kind_of?(URI::HTTP) && value =~ url_regexp
5
5
  record.errors[attribute] << (options[:message] || "is invalid")
6
6
  end
@@ -8,7 +8,7 @@ class UrlFormatValidator < ActiveModel::EachValidator
8
8
  record.errors[attribute] << (options[:message] || "is invalid")
9
9
  end
10
10
 
11
- def format_value(value)
11
+ def format_value(record, attribute, value)
12
12
  record.send("#{attribute}=","http://#{value}") unless value =~ /\Ahttps?:\/\//
13
13
  end
14
14
 
@@ -1,3 +1,3 @@
1
1
  module UrlFormat
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: url_format
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Otander