pseudo_date 0.1.0 → 0.1.2
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/lib/pseudo_date/pseudo_date.rb +1 -2
- data/pseudo_date.gemspec +2 -2
- data/test/test_parser.rb +16 -0
- metadata +18 -5
| @@ -3,8 +3,7 @@ class PseudoDate | |
| 3 3 |  | 
| 4 4 | 
             
              def initialize(input)
         | 
| 5 5 | 
             
                @date_hash = if input.is_a?(Hash)
         | 
| 6 | 
            -
                  input.to_hash. | 
| 7 | 
            -
                  # But it's already a hash!  Well, sometimes silly people pass a Mash object into this without realizing it.
         | 
| 6 | 
            +
                  Hash[input.to_hash.map { |k, v| [k.to_s.downcase.to_sym, v] }]
         | 
| 8 7 | 
             
                else
         | 
| 9 8 | 
             
                  input = '00000000' if input.to_s.strip == '19000000'
         | 
| 10 9 | 
             
                  @date_hash = input.to_s.strip.to_date_hash
         | 
    
        data/pseudo_date.gemspec
    CHANGED
    
    | @@ -2,7 +2,7 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            Gem::Specification.new do |s|
         | 
| 4 4 | 
             
              s.name = %q{pseudo_date}
         | 
| 5 | 
            -
              s.version = "0.1. | 
| 5 | 
            +
              s.version = "0.1.2"
         | 
| 6 6 |  | 
| 7 7 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
         | 
| 8 8 | 
             
              s.authors = ["Patrick Tulskie"]
         | 
| @@ -11,7 +11,7 @@ Gem::Specification.new do |s| | |
| 11 11 | 
             
              s.email = %q{PatrickTulskie@gmail.com}
         | 
| 12 12 | 
             
              s.extra_rdoc_files = ["README.mdown", "lib/core_extensions/object.rb", "lib/core_extensions/string.rb", "lib/pseudo_date.rb", "lib/pseudo_date/parser.rb", "lib/pseudo_date/pseudo_date.rb"]
         | 
| 13 13 | 
             
              s.files = ["Manifest", "README.mdown", "Rakefile", "lib/core_extensions/object.rb", "lib/core_extensions/string.rb", "lib/pseudo_date.rb", "lib/pseudo_date/parser.rb", "lib/pseudo_date/pseudo_date.rb", "test/test_helper.rb", "test/test_parser.rb", "pseudo_date.gemspec"]
         | 
| 14 | 
            -
              s.homepage = %q{http://github.com/PatrickTulskie/ | 
| 14 | 
            +
              s.homepage = %q{http://github.com/PatrickTulskie/pseudo-date}
         | 
| 15 15 | 
             
              s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Pseudo_date", "--main", "README.mdown"]
         | 
| 16 16 | 
             
              s.require_paths = ["lib"]
         | 
| 17 17 | 
             
              s.rubyforge_project = %q{pseudo_date}
         | 
    
        data/test/test_parser.rb
    CHANGED
    
    | @@ -11,6 +11,22 @@ class TestParser < Test::Unit::TestCase | |
| 11 11 | 
             
                  @string_date = 'Jun 25, 1985'
         | 
| 12 12 | 
             
                end
         | 
| 13 13 |  | 
| 14 | 
            +
                context "date hash" do
         | 
| 15 | 
            +
                  should "parse an exact hash" do
         | 
| 16 | 
            +
                    pd = PseudoDate.new(:year => @year, :day => @day, :month => @month)
         | 
| 17 | 
            +
                    assert_equal @day, pd.day
         | 
| 18 | 
            +
                    assert_equal @month, pd.month
         | 
| 19 | 
            +
                    assert_equal @year, pd.year
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
                  
         | 
| 22 | 
            +
                  should "parse a hash inexact keys" do
         | 
| 23 | 
            +
                    pd = PseudoDate.new('Year' => @year, 'day' => @day, :Month => @month)
         | 
| 24 | 
            +
                    assert_equal @day, pd.day
         | 
| 25 | 
            +
                    assert_equal @month, pd.month
         | 
| 26 | 
            +
                    assert_equal @year, pd.year
         | 
| 27 | 
            +
                  end
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
                
         | 
| 14 30 | 
             
                # 19850625
         | 
| 15 31 | 
             
                context "yearmonthday" do
         | 
| 16 32 | 
             
                  should 'be exact precision' do
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: pseudo_date
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
               | 
| 4 | 
            +
              hash: 31
         | 
| 5 | 
            +
              prerelease: 
         | 
| 6 | 
            +
              segments: 
         | 
| 7 | 
            +
              - 0
         | 
| 8 | 
            +
              - 1
         | 
| 9 | 
            +
              - 2
         | 
| 10 | 
            +
              version: 0.1.2
         | 
| 5 11 | 
             
            platform: ruby
         | 
| 6 12 | 
             
            authors: 
         | 
| 7 13 | 
             
            - Patrick Tulskie
         | 
| @@ -39,7 +45,7 @@ files: | |
| 39 45 | 
             
            - test/test_parser.rb
         | 
| 40 46 | 
             
            - pseudo_date.gemspec
         | 
| 41 47 | 
             
            has_rdoc: true
         | 
| 42 | 
            -
            homepage: http://github.com/PatrickTulskie/ | 
| 48 | 
            +
            homepage: http://github.com/PatrickTulskie/pseudo-date
         | 
| 43 49 | 
             
            licenses: []
         | 
| 44 50 |  | 
| 45 51 | 
             
            post_install_message: 
         | 
| @@ -53,21 +59,28 @@ rdoc_options: | |
| 53 59 | 
             
            require_paths: 
         | 
| 54 60 | 
             
            - lib
         | 
| 55 61 | 
             
            required_ruby_version: !ruby/object:Gem::Requirement 
         | 
| 62 | 
            +
              none: false
         | 
| 56 63 | 
             
              requirements: 
         | 
| 57 64 | 
             
              - - ">="
         | 
| 58 65 | 
             
                - !ruby/object:Gem::Version 
         | 
| 66 | 
            +
                  hash: 3
         | 
| 67 | 
            +
                  segments: 
         | 
| 68 | 
            +
                  - 0
         | 
| 59 69 | 
             
                  version: "0"
         | 
| 60 | 
            -
              version: 
         | 
| 61 70 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement 
         | 
| 71 | 
            +
              none: false
         | 
| 62 72 | 
             
              requirements: 
         | 
| 63 73 | 
             
              - - ">="
         | 
| 64 74 | 
             
                - !ruby/object:Gem::Version 
         | 
| 75 | 
            +
                  hash: 11
         | 
| 76 | 
            +
                  segments: 
         | 
| 77 | 
            +
                  - 1
         | 
| 78 | 
            +
                  - 2
         | 
| 65 79 | 
             
                  version: "1.2"
         | 
| 66 | 
            -
              version: 
         | 
| 67 80 | 
             
            requirements: []
         | 
| 68 81 |  | 
| 69 82 | 
             
            rubyforge_project: pseudo_date
         | 
| 70 | 
            -
            rubygems_version: 1.3 | 
| 83 | 
            +
            rubygems_version: 1.5.3
         | 
| 71 84 | 
             
            signing_key: 
         | 
| 72 85 | 
             
            specification_version: 3
         | 
| 73 86 | 
             
            summary: Date parser and container for partial or incomplete dates.
         |