timeliness 0.3.4 → 0.3.5
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.
- data/CHANGELOG.rdoc +3 -0
 - data/lib/timeliness/helpers.rb +1 -1
 - data/lib/timeliness/version.rb +1 -1
 - data/spec/timeliness/format_spec.rb +8 -0
 - data/spec/timeliness/parser_spec.rb +16 -0
 - metadata +19 -40
 
    
        data/CHANGELOG.rdoc
    CHANGED
    
    
    
        data/lib/timeliness/helpers.rb
    CHANGED
    
    
    
        data/lib/timeliness/version.rb
    CHANGED
    
    
| 
         @@ -29,6 +29,14 @@ describe Timeliness::Format do 
     | 
|
| 
       29 
29 
     | 
    
         
             
                  format_for('dd/mm/yyyy').process('2', '1', '2000').should == [2000,1,2,nil,nil,nil,nil,nil]
         
     | 
| 
       30 
30 
     | 
    
         
             
                end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
      
 32 
     | 
    
         
            +
                it "should define method which outputs date array with zeros when month and day are '0'" do
         
     | 
| 
      
 33 
     | 
    
         
            +
                  format_for('m/d/yy').process('0', '0', '0000').should == [0,0,0,nil,nil,nil,nil,nil]
         
     | 
| 
      
 34 
     | 
    
         
            +
                end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                it "should define method which outputs date array with zeros when month and day are '00'" do
         
     | 
| 
      
 37 
     | 
    
         
            +
                  format_for('m/d/yy').process('00', '00', '0000').should == [0,0,0,nil,nil,nil,nil,nil]
         
     | 
| 
      
 38 
     | 
    
         
            +
                end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
       32 
40 
     | 
    
         
             
                it "should define method which outputs time array" do
         
     | 
| 
       33 
41 
     | 
    
         
             
                  format_for('hh:nn:ss').process('01', '02', '03').should == [nil,nil,nil,1,2,3,nil,nil]
         
     | 
| 
       34 
42 
     | 
    
         
             
                end
         
     | 
| 
         @@ -31,6 +31,14 @@ describe Timeliness::Parser do 
     | 
|
| 
       31 
31 
     | 
    
         
             
                  should_not_parse("2000-02-30")
         
     | 
| 
       32 
32 
     | 
    
         
             
                end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
      
 34 
     | 
    
         
            +
                it "should return nil for invalid date string where month is '0'" do
         
     | 
| 
      
 35 
     | 
    
         
            +
                  should_not_parse("0/01/2000")
         
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                it "should return nil for invalid date string where month is '00'" do
         
     | 
| 
      
 39 
     | 
    
         
            +
                  should_not_parse("00/01/2000")
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
       34 
42 
     | 
    
         
             
                it "should return time object for valid time string" do
         
     | 
| 
       35 
43 
     | 
    
         
             
                  parse("12:13:14").should be_kind_of(Time)
         
     | 
| 
       36 
44 
     | 
    
         
             
                end
         
     | 
| 
         @@ -123,6 +131,10 @@ describe Timeliness::Parser do 
     | 
|
| 
       123 
131 
     | 
    
         
             
                  it "should return time object for valid datetime string" do
         
     | 
| 
       124 
132 
     | 
    
         
             
                    parse("2000-01-01 12:13:14", :datetime).should == Time.local(2000,1,1,12,13,14)
         
     | 
| 
       125 
133 
     | 
    
         
             
                  end
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
                  it "should return nil for invalid date string" do
         
     | 
| 
      
 136 
     | 
    
         
            +
                    parse("0/01/2000", :datetime).should be_nil
         
     | 
| 
      
 137 
     | 
    
         
            +
                  end
         
     | 
| 
       126 
138 
     | 
    
         
             
                end
         
     | 
| 
       127 
139 
     | 
    
         | 
| 
       128 
140 
     | 
    
         
             
                context "with :date type" do
         
     | 
| 
         @@ -133,6 +145,10 @@ describe Timeliness::Parser do 
     | 
|
| 
       133 
145 
     | 
    
         
             
                  it "should ignore time in datetime string" do
         
     | 
| 
       134 
146 
     | 
    
         
             
                    parse('2000-02-01 12:13', :date).should == Time.local(2000,2,1)
         
     | 
| 
       135 
147 
     | 
    
         
             
                  end
         
     | 
| 
      
 148 
     | 
    
         
            +
             
     | 
| 
      
 149 
     | 
    
         
            +
                  it "should return nil for invalid date string" do
         
     | 
| 
      
 150 
     | 
    
         
            +
                    parse("0/01/2000", :date).should be_nil
         
     | 
| 
      
 151 
     | 
    
         
            +
                  end
         
     | 
| 
       136 
152 
     | 
    
         
             
                end
         
     | 
| 
       137 
153 
     | 
    
         | 
| 
       138 
154 
     | 
    
         
             
                context "with :time type" do
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,34 +1,24 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            --- !ruby/object:Gem::Specification 
     | 
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: timeliness
         
     | 
| 
       3 
     | 
    
         
            -
            version: !ruby/object:Gem::Version 
     | 
| 
       4 
     | 
    
         
            -
               
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.5
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
     | 
    
         
            -
              segments: 
         
     | 
| 
       7 
     | 
    
         
            -
              - 0
         
     | 
| 
       8 
     | 
    
         
            -
              - 3
         
     | 
| 
       9 
     | 
    
         
            -
              - 4
         
     | 
| 
       10 
     | 
    
         
            -
              version: 0.3.4
         
     | 
| 
       11 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
     | 
    
         
            -
            authors: 
     | 
| 
      
 7 
     | 
    
         
            +
            authors:
         
     | 
| 
       13 
8 
     | 
    
         
             
            - Adam Meehan
         
     | 
| 
       14 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       15 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            date: 2011-05-26 00:00:00 +10:00
         
     | 
| 
       19 
     | 
    
         
            -
            default_executable: 
         
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2012-03-29 00:00:00.000000000Z
         
     | 
| 
       20 
13 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
14 
     | 
    
         
             
            description: Fast date/time parser with customisable formats, timezone and I18n support.
         
     | 
| 
       23 
15 
     | 
    
         
             
            email: adam.meehan@gmail.com
         
     | 
| 
       24 
16 
     | 
    
         
             
            executables: []
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
17 
     | 
    
         
             
            extensions: []
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
            extra_rdoc_files: 
         
     | 
| 
      
 18 
     | 
    
         
            +
            extra_rdoc_files:
         
     | 
| 
       29 
19 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       30 
20 
     | 
    
         
             
            - CHANGELOG.rdoc
         
     | 
| 
       31 
     | 
    
         
            -
            files: 
     | 
| 
      
 21 
     | 
    
         
            +
            files:
         
     | 
| 
       32 
22 
     | 
    
         
             
            - CHANGELOG.rdoc
         
     | 
| 
       33 
23 
     | 
    
         
             
            - LICENSE
         
     | 
| 
       34 
24 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
         @@ -50,39 +40,28 @@ files: 
     | 
|
| 
       50 
40 
     | 
    
         
             
            - spec/timeliness/format_spec.rb
         
     | 
| 
       51 
41 
     | 
    
         
             
            - spec/timeliness/parser_spec.rb
         
     | 
| 
       52 
42 
     | 
    
         
             
            - timeliness.gemspec
         
     | 
| 
       53 
     | 
    
         
            -
            has_rdoc: true
         
     | 
| 
       54 
43 
     | 
    
         
             
            homepage: http://github.com/adzap/timeliness
         
     | 
| 
       55 
44 
     | 
    
         
             
            licenses: []
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
45 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       58 
46 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
            require_paths: 
         
     | 
| 
      
 47 
     | 
    
         
            +
            require_paths:
         
     | 
| 
       61 
48 
     | 
    
         
             
            - lib
         
     | 
| 
       62 
     | 
    
         
            -
            required_ruby_version: !ruby/object:Gem::Requirement 
     | 
| 
      
 49 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       63 
50 
     | 
    
         
             
              none: false
         
     | 
| 
       64 
     | 
    
         
            -
              requirements: 
     | 
| 
       65 
     | 
    
         
            -
              - -  
     | 
| 
       66 
     | 
    
         
            -
                - !ruby/object:Gem::Version 
     | 
| 
       67 
     | 
    
         
            -
                   
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
                  - 0
         
     | 
| 
       70 
     | 
    
         
            -
                  version: "0"
         
     | 
| 
       71 
     | 
    
         
            -
            required_rubygems_version: !ruby/object:Gem::Requirement 
         
     | 
| 
      
 51 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 53 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       72 
56 
     | 
    
         
             
              none: false
         
     | 
| 
       73 
     | 
    
         
            -
              requirements: 
     | 
| 
       74 
     | 
    
         
            -
              - -  
     | 
| 
       75 
     | 
    
         
            -
                - !ruby/object:Gem::Version 
     | 
| 
       76 
     | 
    
         
            -
                   
     | 
| 
       77 
     | 
    
         
            -
                  segments: 
         
     | 
| 
       78 
     | 
    
         
            -
                  - 0
         
     | 
| 
       79 
     | 
    
         
            -
                  version: "0"
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 58 
     | 
    
         
            +
              - - ! '>='
         
     | 
| 
      
 59 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 60 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
       80 
61 
     | 
    
         
             
            requirements: []
         
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
62 
     | 
    
         
             
            rubyforge_project: timeliness
         
     | 
| 
       83 
     | 
    
         
            -
            rubygems_version: 1. 
     | 
| 
      
 63 
     | 
    
         
            +
            rubygems_version: 1.8.6
         
     | 
| 
       84 
64 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       85 
65 
     | 
    
         
             
            specification_version: 3
         
     | 
| 
       86 
66 
     | 
    
         
             
            summary: Date/time parsing for the control freak.
         
     | 
| 
       87 
67 
     | 
    
         
             
            test_files: []
         
     | 
| 
       88 
     | 
    
         
            -
             
     |