validate_url 0.2.2 → 1.0.0
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 +4 -4
 - data/lib/locale/en.yml +4 -0
 - data/lib/locale/it.yml +4 -0
 - data/lib/validate_url.rb +4 -2
 - metadata +5 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 96f44ddca984d787f96ec16966b40dc93e3a6e99
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 4c769029b3a14ce585a894fb6be20441faacfe73
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 161b331bf596ea903da5a4a57f4b1c8478bcf8e3a5532e97830a63476221465766153b6aa87eae8e7c3d105fd2aee1b01dc298f00e97a8c762b6d0a2e6972aa4
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4e4b02215f6245cdb3bb0aff2a979afddd3c0d31c91b3c407320a16137e2f69e49e6aa6385b22d8d8528539b707bd291ebb5b98aaba240811a338cc64c81d0a1
         
     | 
    
        data/lib/locale/en.yml
    ADDED
    
    
    
        data/lib/locale/it.yml
    ADDED
    
    
    
        data/lib/validate_url.rb
    CHANGED
    
    | 
         @@ -1,5 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'addressable/uri'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require 'active_model'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'active_support/i18n'
         
     | 
| 
      
 4 
     | 
    
         
            +
            I18n.load_path << File.dirname(__FILE__) + '/locale/en.yml'
         
     | 
| 
       3 
5 
     | 
    
         | 
| 
       4 
6 
     | 
    
         
             
            module ActiveModel
         
     | 
| 
       5 
7 
     | 
    
         
             
              module Validations
         
     | 
| 
         @@ -7,7 +9,7 @@ module ActiveModel 
     | 
|
| 
       7 
9 
     | 
    
         | 
| 
       8 
10 
     | 
    
         
             
                  def initialize(options)
         
     | 
| 
       9 
11 
     | 
    
         
             
                    options.reverse_merge!(:schemes => %w(http https))
         
     | 
| 
       10 
     | 
    
         
            -
                    options.reverse_merge!(:message =>  
     | 
| 
      
 12 
     | 
    
         
            +
                    options.reverse_merge!(:message => :url)
         
     | 
| 
       11 
13 
     | 
    
         
             
                    super(options)
         
     | 
| 
       12 
14 
     | 
    
         
             
                  end
         
     | 
| 
       13 
15 
     | 
    
         | 
| 
         @@ -15,7 +17,7 @@ module ActiveModel 
     | 
|
| 
       15 
17 
     | 
    
         
             
                    schemes = [*options.fetch(:schemes)].map(&:to_s)
         
     | 
| 
       16 
18 
     | 
    
         
             
                    begin
         
     | 
| 
       17 
19 
     | 
    
         
             
                      uri = Addressable::URI.parse(value)
         
     | 
| 
       18 
     | 
    
         
            -
                      unless uri && schemes.include?(uri.scheme)
         
     | 
| 
      
 20 
     | 
    
         
            +
                      unless uri && uri.host && schemes.include?(uri.scheme)
         
     | 
| 
       19 
21 
     | 
    
         
             
                        record.errors.add(attribute, options.fetch(:message), :value => value)
         
     | 
| 
       20 
22 
     | 
    
         
             
                      end
         
     | 
| 
       21 
23 
     | 
    
         
             
                    rescue Addressable::URI::InvalidURIError
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: validate_url
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Tanel Suurhans
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2014- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2014-11-13 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: activemodel
         
     | 
| 
         @@ -81,6 +81,8 @@ files: 
     | 
|
| 
       81 
81 
     | 
    
         
             
            - README.md
         
     | 
| 
       82 
82 
     | 
    
         
             
            - init.rb
         
     | 
| 
       83 
83 
     | 
    
         
             
            - install.rb
         
     | 
| 
      
 84 
     | 
    
         
            +
            - lib/locale/en.yml
         
     | 
| 
      
 85 
     | 
    
         
            +
            - lib/locale/it.yml
         
     | 
| 
       84 
86 
     | 
    
         
             
            - lib/validate_url.rb
         
     | 
| 
       85 
87 
     | 
    
         
             
            homepage: http://github.com/perfectline/validates_url/tree/master
         
     | 
| 
       86 
88 
     | 
    
         
             
            licenses: []
         
     | 
| 
         @@ -106,3 +108,4 @@ signing_key: 
     | 
|
| 
       106 
108 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       107 
109 
     | 
    
         
             
            summary: Library for validating urls in Rails.
         
     | 
| 
       108 
110 
     | 
    
         
             
            test_files: []
         
     | 
| 
      
 111 
     | 
    
         
            +
            has_rdoc: 
         
     |