revs-utils 1.0.12 → 1.0.13
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 +8 -8
 - data/Gemfile.lock +2 -0
 - data/lib/revs-utils/version.rb +1 -1
 - data/lib/revs-utils.rb +2 -3
 - data/revs-utils.gemspec +1 -0
 - data/spec/revs-utils_spec.rb +3 -0
 - metadata +15 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,15 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            !binary "U0hBMQ==":
         
     | 
| 
       3 
3 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
      
 4 
     | 
    
         
            +
                NjU2NmIwNThmMTdhOTYzNjE1YjMzZGYzNDVmOTkxMGViMTEzZmVkZA==
         
     | 
| 
       5 
5 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       6 
     | 
    
         
            -
                 
     | 
| 
      
 6 
     | 
    
         
            +
                NDNjZWEwMzJmYmMyMWE2ZmJjMjM4ZDk2NmFmNzJhNDVmNGNiNTBlOA==
         
     | 
| 
       7 
7 
     | 
    
         
             
            SHA512:
         
     | 
| 
       8 
8 
     | 
    
         
             
              metadata.gz: !binary |-
         
     | 
| 
       9 
     | 
    
         
            -
                 
     | 
| 
       10 
     | 
    
         
            -
                 
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 9 
     | 
    
         
            +
                ZmMxNDcwYjJmNDY1NzBiYzExYjMxZGVkOGMzNjA5YTVhNzg2ZWRhNGZhODBk
         
     | 
| 
      
 10 
     | 
    
         
            +
                NmMzMGNlOTFlZDRjODNmZjFkNTlhZGQ4OWVlNTg0ZjQ2NTdhNzJkMDVlNjU1
         
     | 
| 
      
 11 
     | 
    
         
            +
                Y2VmYzYyNDQzN2VlNGE0N2FmNGU2ZGQ2MWI0ODVkMDI5NjgyNjk=
         
     | 
| 
       12 
12 
     | 
    
         
             
              data.tar.gz: !binary |-
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                 
     | 
| 
       15 
     | 
    
         
            -
                 
     | 
| 
      
 13 
     | 
    
         
            +
                ZmIwZWQxZDBlNTM0ZjIzYmQ4YTliZWQyZTc2NmY3OGY4ZDAzZjM5MjRlZGJk
         
     | 
| 
      
 14 
     | 
    
         
            +
                OTE4MzFhZTNiN2YyYzYyNDlmNjA2ODljYThiMzMwNDZiMGFhNTk1YzRiM2E2
         
     | 
| 
      
 15 
     | 
    
         
            +
                YjcxN2YxYmI5ZTc0YTMwZjAxM2IzNmJjYThmZDZlOWQ0OGNhOGE=
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    | 
         @@ -3,6 +3,7 @@ PATH 
     | 
|
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
4 
     | 
    
         
             
                revs-utils (1.0.12)
         
     | 
| 
       5 
5 
     | 
    
         
             
                  actionpack (~> 3)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  chronic
         
     | 
| 
       6 
7 
     | 
    
         
             
                  countries (= 0.9.2)
         
     | 
| 
       7 
8 
     | 
    
         
             
                  rdf
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
         @@ -27,6 +28,7 @@ GEM 
     | 
|
| 
       27 
28 
     | 
    
         
             
                  i18n (~> 0.6, >= 0.6.4)
         
     | 
| 
       28 
29 
     | 
    
         
             
                  multi_json (~> 1.0)
         
     | 
| 
       29 
30 
     | 
    
         
             
                builder (3.0.4)
         
     | 
| 
      
 31 
     | 
    
         
            +
                chronic (0.10.2)
         
     | 
| 
       30 
32 
     | 
    
         
             
                countries (0.9.2)
         
     | 
| 
       31 
33 
     | 
    
         
             
                  currencies (>= 0.4.0)
         
     | 
| 
       32 
34 
     | 
    
         
             
                currencies (0.4.2)
         
     | 
    
        data/lib/revs-utils/version.rb
    CHANGED
    
    
    
        data/lib/revs-utils.rb
    CHANGED
    
    | 
         @@ -5,6 +5,7 @@ require "countries" 
     | 
|
| 
       5 
5 
     | 
    
         
             
            require 'active_support/core_ext/string'
         
     | 
| 
       6 
6 
     | 
    
         
             
            require 'active_support/core_ext/hash'
         
     | 
| 
       7 
7 
     | 
    
         
             
            require 'csv'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'chronic'
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
10 
     | 
    
         
             
            PROJECT_ROOT = File.expand_path(File.dirname(__FILE__) + '/..')
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
         @@ -239,9 +240,7 @@ module Revs 
     | 
|
| 
       239 
240 
     | 
    
         
             
                  # tell us if the string passed is in is a full date of the format M/D/YYYY or m-d-yyyy or m-d-yy or M/D/YY, and returns the date object if it is valid
         
     | 
| 
       240 
241 
     | 
    
         
             
                  def get_full_date(date_string)
         
     | 
| 
       241 
242 
     | 
    
         
             
                    begin
         
     | 
| 
       242 
     | 
    
         
            -
                       
     | 
| 
       243 
     | 
    
         
            -
                      date_format = (date_obj_string.split('/').last.size == 4 ? '%m/%d/%Y' : '%m/%d/%y') # if we think we have a 4 digit year, parse with 4 year format, else try the two year format
         
     | 
| 
       244 
     | 
    
         
            -
                      date_obj = Date.strptime(date_obj_string, date_format)
         
     | 
| 
      
 243 
     | 
    
         
            +
                      date_obj=Chronic.parse(date_string).to_date
         
     | 
| 
       245 
244 
     | 
    
         
             
                      date_obj=date_obj.prev_year(100) if date_obj > Date.today # if the parsing yields a date in the future, this is a problem, so adjust back a century (due to this issue: http://stackoverflow.com/questions/27058068/ruby-incorrectly-parses-2-digit-year)
         
     | 
| 
       246 
245 
     | 
    
         
             
                      is_valid_year?(date_obj.year.to_s) ? date_obj : false
         
     | 
| 
       247 
246 
     | 
    
         
             
                    rescue
         
     | 
    
        data/revs-utils.gemspec
    CHANGED
    
    | 
         @@ -21,6 +21,7 @@ Gem::Specification.new do |gem| 
     | 
|
| 
       21 
21 
     | 
    
         
             
              gem.add_dependency "countries", "0.9.2"
         
     | 
| 
       22 
22 
     | 
    
         
             
              gem.add_dependency "rdf"
         
     | 
| 
       23 
23 
     | 
    
         
             
              gem.add_dependency "actionpack", '~> 3'
         
     | 
| 
      
 24 
     | 
    
         
            +
              gem.add_dependency "chronic"
         
     | 
| 
       24 
25 
     | 
    
         | 
| 
       25 
26 
     | 
    
         
             
              gem.add_development_dependency "rspec", "~> 2.6"
         
     | 
| 
       26 
27 
     | 
    
         
             
              gem.add_development_dependency "lyberteam-gems-devel", "> 1.0.0"
         
     | 
    
        data/spec/revs-utils_spec.rb
    CHANGED
    
    | 
         @@ -83,6 +83,9 @@ describe "Revs-Utils" do 
     | 
|
| 
       83 
83 
     | 
    
         
             
                 @revs.get_full_date('1/1/71').should == Date.strptime("1/1/1971", '%m/%d/%Y') # deal with two digit years ok too
         
     | 
| 
       84 
84 
     | 
    
         
             
                 @revs.get_full_date('5-1-14').should == Date.strptime("5/1/2014", '%m/%d/%Y') # deal with two digit years ok too     
         
     | 
| 
       85 
85 
     | 
    
         
             
                 @revs.get_full_date('5-1-21').should == Date.strptime("5/1/1921", '%m/%d/%Y') # deal with two digit years ok too     
         
     | 
| 
      
 86 
     | 
    
         
            +
                 @revs.get_full_date('1966-02-27').should == Date.strptime("2/27/1966", '%m/%d/%Y') # deal with alternate formats
         
     | 
| 
      
 87 
     | 
    
         
            +
                 @revs.get_full_date('1966-2-5').should == Date.strptime("2/5/1966", '%m/%d/%Y') # deal with alternate formats
         
     | 
| 
      
 88 
     | 
    
         
            +
                 @revs.get_full_date('1966-14-11').should be_false
         
     | 
| 
       86 
89 
     | 
    
         
             
                 @revs.get_full_date('bogus').should be_false
         
     | 
| 
       87 
90 
     | 
    
         
             
               end
         
     | 
| 
       88 
91 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: revs-utils
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.13
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Peter Mangiafico
         
     | 
| 
         @@ -52,6 +52,20 @@ dependencies: 
     | 
|
| 
       52 
52 
     | 
    
         
             
                - - ~>
         
     | 
| 
       53 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
54 
     | 
    
         
             
                    version: '3'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: chronic
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - ! '>='
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       55 
69 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       56 
70 
     | 
    
         
             
              name: rspec
         
     | 
| 
       57 
71 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     |