parsi-date 0.3.1 → 0.4.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 +5 -5
 - data/.github/workflows/ruby.yml +27 -0
 - data/lib/parsi-date.rb +6 -3
 - data/lib/version.rb +1 -1
 - data/parsi-date.gemspec +5 -5
 - data/spec/parsi-date/accessor_spec.rb +13 -13
 - data/spec/parsi-date/accessors_helper_spec.rb +2 -2
 - data/spec/parsi-date/add_month_spec.rb +6 -8
 - data/spec/parsi-date/add_spec.rb +6 -8
 - data/spec/parsi-date/comp_spec.rb +9 -9
 - data/spec/parsi-date/constants_spec.rb +9 -9
 - data/spec/parsi-date/construction_spec.rb +11 -11
 - data/spec/parsi-date/conversion_spec.rb +9 -9
 - data/spec/parsi-date/leap_spec.rb +8 -6
 - data/spec/parsi-date/step_spec.rb +14 -14
 - data/spec/parsi-date/strftime_spec.rb +60 -60
 - data/spec/parsi-date/week_methods_spec.rb +8 -8
 - data/spec/spec_helper.rb +0 -1
 - metadata +17 -20
 - data/.travis.yml +0 -6
 - data/TODO +0 -13
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 2 
     | 
    
         
            +
            SHA256:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: e8e274346e199194141c9e715233cd1ce4fd88262abae4ddbcab5861c3a8f22f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0dbcb0ae86ff18037e23f42c42eb059ae777e4e35360e685d1e4c1966b6d624f
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4bb7986d931227c9bb2630593c3ebbc9d2bb6305256bde113dd9db9e7dc6aaf93181070f1c92ca486bb665f88a5ba5ac81a77e9d4227bc538b794dbb9f9c451e
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 439b3f899dff9c1507cd78dcef919fe75e2d087382bba7a6428778dc69572d1ed4f40e2e9ea69a83502ae72366f8aa39425662fe445196048d34b3742d828acb
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            name: Ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            on:
         
     | 
| 
      
 4 
     | 
    
         
            +
              push:
         
     | 
| 
      
 5 
     | 
    
         
            +
                branches: [master]
         
     | 
| 
      
 6 
     | 
    
         
            +
              pull_request:
         
     | 
| 
      
 7 
     | 
    
         
            +
                branches: [master]
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            permissions:
         
     | 
| 
      
 10 
     | 
    
         
            +
              contents: read
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            jobs:
         
     | 
| 
      
 13 
     | 
    
         
            +
              test:
         
     | 
| 
      
 14 
     | 
    
         
            +
                runs-on: ubuntu-latest
         
     | 
| 
      
 15 
     | 
    
         
            +
                strategy:
         
     | 
| 
      
 16 
     | 
    
         
            +
                  matrix:
         
     | 
| 
      
 17 
     | 
    
         
            +
                    ruby-version: ["2.6", "2.7", "3.0", "3.1"]
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                steps:
         
     | 
| 
      
 20 
     | 
    
         
            +
                  - uses: actions/checkout@v3
         
     | 
| 
      
 21 
     | 
    
         
            +
                  - name: Set up Ruby
         
     | 
| 
      
 22 
     | 
    
         
            +
                    uses: ruby/setup-ruby@v1
         
     | 
| 
      
 23 
     | 
    
         
            +
                    with:
         
     | 
| 
      
 24 
     | 
    
         
            +
                      ruby-version: ${{ matrix.ruby-version }}
         
     | 
| 
      
 25 
     | 
    
         
            +
                      bundler-cache: true
         
     | 
| 
      
 26 
     | 
    
         
            +
                  - name: Run tests
         
     | 
| 
      
 27 
     | 
    
         
            +
                    run: bundle exec rspec spec
         
     | 
    
        data/lib/parsi-date.rb
    CHANGED
    
    | 
         @@ -141,11 +141,13 @@ module Parsi 
     | 
|
| 
       141 
141 
     | 
    
         
             
                LD_EPOCH_IN_CJD        = 2299160 # :nodoc:
         
     | 
| 
       142 
142 
     | 
    
         
             
                DAYS_IN_MONTH          = [nil, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29] # :nodoc:
         
     | 
| 
       143 
143 
     | 
    
         | 
| 
      
 144 
     | 
    
         
            +
                LEAP_REMINDERS         = [1, 5, 9, 13, 17, 22, 26, 30].freeze
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
       144 
146 
     | 
    
         
             
                shared_methods = Module.new do
         
     | 
| 
       145 
147 
     | 
    
         | 
| 
       146 
148 
     | 
    
         
             
                  # Returns true if the given year is a leap year of the calendar.
         
     | 
| 
       147 
149 
     | 
    
         
             
                  def leap? year
         
     | 
| 
       148 
     | 
    
         
            -
                    ( 
     | 
| 
      
 150 
     | 
    
         
            +
                    LEAP_REMINDERS.include?(year - (year / 33).floor * 33)
         
     | 
| 
       149 
151 
     | 
    
         
             
                  end
         
     | 
| 
       150 
152 
     | 
    
         
             
                  alias_method :jalali_leap?, :leap?
         
     | 
| 
       151 
153 
     | 
    
         | 
| 
         @@ -189,7 +191,7 @@ module Parsi 
     | 
|
| 
       189 
191 
     | 
    
         
             
                  # Returns the corresponding Julian Day Number if they do, nil if they don't.
         
     | 
| 
       190 
192 
     | 
    
         
             
                  # Invalid values cause an ArgumentError to be raised.
         
     | 
| 
       191 
193 
     | 
    
         
             
                  def _valid_civil? year, month, day # :nodoc:
         
     | 
| 
       192 
     | 
    
         
            -
                    return unless year.is_a?( 
     | 
| 
      
 194 
     | 
    
         
            +
                    return unless year.is_a?(Integer) && month.is_a?(Integer) && day.is_a?(Integer)
         
     | 
| 
       193 
195 
     | 
    
         
             
                    return civil_to_jd(year, 12, 30) if leap?(year) && month == 12 && day == 30
         
     | 
| 
       194 
196 
     | 
    
         | 
| 
       195 
197 
     | 
    
         
             
                    if 1 <= month && month <= 12 && 1 <= day && day <= DAYS_IN_MONTH[month]
         
     | 
| 
         @@ -747,8 +749,9 @@ class Date 
     | 
|
| 
       747 
749 
     | 
    
         | 
| 
       748 
750 
     | 
    
         
             
              # Returns a Parsi::Date object representing same date in Jalali calendar
         
     | 
| 
       749 
751 
     | 
    
         
             
              def to_parsi
         
     | 
| 
       750 
     | 
    
         
            -
                Parsi::Date.new! ajd 
     | 
| 
      
 752 
     | 
    
         
            +
                Parsi::Date.new! ajd
         
     | 
| 
       751 
753 
     | 
    
         
             
              end
         
     | 
| 
      
 754 
     | 
    
         
            +
             
     | 
| 
       752 
755 
     | 
    
         
             
              alias :jalali     :to_parsi
         
     | 
| 
       753 
756 
     | 
    
         
             
              alias :to_jalali  :to_parsi
         
     | 
| 
       754 
757 
     | 
    
         
             
              alias :to_persian :to_parsi
         
     | 
    
        data/lib/version.rb
    CHANGED
    
    
    
        data/parsi-date.gemspec
    CHANGED
    
    | 
         @@ -18,9 +18,9 @@ Gem::Specification.new do |s| 
     | 
|
| 
       18 
18 
     | 
    
         
             
              s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         
     | 
| 
       19 
19 
     | 
    
         
             
              s.require_paths = ['lib']
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
              s.add_development_dependency("bundler", "~>  
     | 
| 
       22 
     | 
    
         
            -
              s.add_development_dependency("rake", "~>  
     | 
| 
       23 
     | 
    
         
            -
              s.add_development_dependency("rspec", "~>  
     | 
| 
       24 
     | 
    
         
            -
              s.add_development_dependency("activerecord", "~>  
     | 
| 
       25 
     | 
    
         
            -
              s.add_development_dependency("sqlite3", "~> 1. 
     | 
| 
      
 21 
     | 
    
         
            +
              s.add_development_dependency("bundler", "~> 2.0")
         
     | 
| 
      
 22 
     | 
    
         
            +
              s.add_development_dependency("rake", "~> 13.0")
         
     | 
| 
      
 23 
     | 
    
         
            +
              s.add_development_dependency("rspec", "~> 3.0")
         
     | 
| 
      
 24 
     | 
    
         
            +
              s.add_development_dependency("activerecord", "~> 6.0")
         
     | 
| 
      
 25 
     | 
    
         
            +
              s.add_development_dependency("sqlite3", "~> 1.5")
         
     | 
| 
       26 
26 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,57 +1,57 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            describe "Parsi::Date#ajd" do
         
     | 
| 
       2 
2 
     | 
    
         
             
              it "determines the Astronomical Julian day" do
         
     | 
| 
       3 
     | 
    
         
            -
                Parsi::Date.civil(1391, 8, 6).ajd 
     | 
| 
      
 3 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 8, 6).ajd == Rational(4912455, 2)
         
     | 
| 
       4 
4 
     | 
    
         
             
              end
         
     | 
| 
       5 
5 
     | 
    
         
             
            end
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            describe "Parsi::Date#amjd" do
         
     | 
| 
       8 
8 
     | 
    
         
             
              it "determines the Astronomical Modified Julian day" do
         
     | 
| 
       9 
     | 
    
         
            -
                Parsi::Date.civil(1391, 8, 6).amjd 
     | 
| 
      
 9 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 8, 6).amjd == 56227
         
     | 
| 
       10 
10 
     | 
    
         
             
              end
         
     | 
| 
       11 
11 
     | 
    
         
             
            end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
            describe "Parsi::Date#mjd" do
         
     | 
| 
       14 
14 
     | 
    
         
             
              it "determines the Modified Julian day" do
         
     | 
| 
       15 
     | 
    
         
            -
                Parsi::Date.civil(1391, 8, 6).mjd 
     | 
| 
      
 15 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 8, 6).mjd == 56227
         
     | 
| 
       16 
16 
     | 
    
         
             
              end
         
     | 
| 
       17 
17 
     | 
    
         
             
            end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            describe "Parsi::Date#ld" do
         
     | 
| 
       20 
20 
     | 
    
         
             
              it "determines the Modified Julian day" do
         
     | 
| 
       21 
     | 
    
         
            -
                Parsi::Date.civil(1391, 8, 6).ld 
     | 
| 
      
 21 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 8, 6).ld == 157068
         
     | 
| 
       22 
22 
     | 
    
         
             
              end
         
     | 
| 
       23 
23 
     | 
    
         
             
            end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
            describe "Parsi::Date#year" do
         
     | 
| 
       26 
26 
     | 
    
         
             
              it "determines the year" do
         
     | 
| 
       27 
     | 
    
         
            -
                Parsi::Date.civil(1391, 8, 6).year 
     | 
| 
      
 27 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 8, 6).year == 1391
         
     | 
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
       29 
29 
     | 
    
         
             
            end
         
     | 
| 
       30 
30 
     | 
    
         | 
| 
       31 
31 
     | 
    
         
             
            describe "Parsi::Date#yday" do
         
     | 
| 
       32 
32 
     | 
    
         
             
              it "determines the year" do
         
     | 
| 
       33 
     | 
    
         
            -
                Parsi::Date.civil(1391, 1, 17).yday 
     | 
| 
       34 
     | 
    
         
            -
                Parsi::Date.civil(1391, 8, 6).yday 
     | 
| 
      
 33 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 1, 17).yday == 17
         
     | 
| 
      
 34 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 8, 6).yday == 222
         
     | 
| 
       35 
35 
     | 
    
         
             
              end
         
     | 
| 
       36 
36 
     | 
    
         
             
            end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
            describe "Parsi::Date#mon" do
         
     | 
| 
       39 
39 
     | 
    
         
             
              it "determines the month" do
         
     | 
| 
       40 
     | 
    
         
            -
                Parsi::Date.civil(1391, 1, 17).mon 
     | 
| 
       41 
     | 
    
         
            -
                Parsi::Date.civil(1391, 8, 6).mon 
     | 
| 
      
 40 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 1, 17).mon == 1
         
     | 
| 
      
 41 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 8, 6).mon == 8
         
     | 
| 
       42 
42 
     | 
    
         
             
              end
         
     | 
| 
       43 
43 
     | 
    
         
             
            end
         
     | 
| 
       44 
44 
     | 
    
         | 
| 
       45 
45 
     | 
    
         
             
            describe "Parsi::Date#mday" do
         
     | 
| 
       46 
46 
     | 
    
         
             
              it "determines the day of the month" do
         
     | 
| 
       47 
     | 
    
         
            -
                Parsi::Date.civil(1391, 1, 17).mday 
     | 
| 
       48 
     | 
    
         
            -
                Parsi::Date.civil(1391, 10, 28).mday 
     | 
| 
      
 47 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 1, 17).mday == 17
         
     | 
| 
      
 48 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 10, 28).mday == 28
         
     | 
| 
       49 
49 
     | 
    
         
             
              end
         
     | 
| 
       50 
50 
     | 
    
         
             
            end
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
52 
     | 
    
         
             
            describe "Parsi::Date#wday" do
         
     | 
| 
       53 
53 
     | 
    
         
             
              it "determines the week day" do
         
     | 
| 
       54 
     | 
    
         
            -
                Parsi::Date.civil(1391, 1, 17).wday 
     | 
| 
       55 
     | 
    
         
            -
                Parsi::Date.civil(1391, 8, 6).wday 
     | 
| 
      
 54 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 1, 17).wday == 4
         
     | 
| 
      
 55 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 8, 6).wday == 6
         
     | 
| 
       56 
56 
     | 
    
         
             
              end
         
     | 
| 
       57 
57 
     | 
    
         
             
            end
         
     | 
| 
         @@ -24,7 +24,7 @@ end 
     | 
|
| 
       24 
24 
     | 
    
         
             
            describe "Record extended with Parsi::Date::Accessors" do
         
     | 
| 
       25 
25 
     | 
    
         
             
              it "has parsi postfixed accessor for giver attributes" do
         
     | 
| 
       26 
26 
     | 
    
         
             
                record = Record.new
         
     | 
| 
       27 
     | 
    
         
            -
                 
     | 
| 
      
 27 
     | 
    
         
            +
                [:created_at_parsi, :created_at_parsi=, :updated_at_parsi, :updated_at_parsi].each do |name|
         
     | 
| 
       28 
28 
     | 
    
         
             
                  expect(record.respond_to?(name)).to be_truthy
         
     | 
| 
       29 
29 
     | 
    
         
             
                end
         
     | 
| 
       30 
30 
     | 
    
         
             
              end
         
     | 
| 
         @@ -55,7 +55,7 @@ describe "Record extended with Parsi::Date::Accessors" do 
     | 
|
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
                  it "raises error when string is not a date" do
         
     | 
| 
       57 
57 
     | 
    
         
             
                    record = Record.new
         
     | 
| 
       58 
     | 
    
         
            -
                    expect {record.created_at_parsi = "1393-13-11" }.to raise_error
         
     | 
| 
      
 58 
     | 
    
         
            +
                    expect {record.created_at_parsi = "1393-13-11" }.to raise_error(ArgumentError, 'invalid date')
         
     | 
| 
       59 
59 
     | 
    
         
             
                  end
         
     | 
| 
       60 
60 
     | 
    
         
             
                end
         
     | 
| 
       61 
61 
     | 
    
         
             
              end
         
     | 
| 
         @@ -1,27 +1,25 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            describe "Parsi::Date#>>" do
         
     | 
| 
       2 
2 
     | 
    
         
             
              it "adds the number of months to a Parsi::Date" do
         
     | 
| 
       3 
     | 
    
         
            -
                 
     | 
| 
       4 
     | 
    
         
            -
                d.should == Parsi::Date.civil(1391, 12, 27)
         
     | 
| 
      
 3 
     | 
    
         
            +
                expect (Parsi::Date.civil(1391, 2, 27) >> 10) == Parsi::Date.civil(1391, 12, 27)
         
     | 
| 
       5 
4 
     | 
    
         
             
              end
         
     | 
| 
       6 
5 
     | 
    
         | 
| 
       7 
6 
     | 
    
         
             
              it "sets the day to the last day of a month if the day doesn't exist" do
         
     | 
| 
       8 
     | 
    
         
            -
                 
     | 
| 
       9 
     | 
    
         
            -
                d.should == Parsi::Date.civil(1391, 7, 30)
         
     | 
| 
      
 7 
     | 
    
         
            +
                expect (Parsi::Date.civil(1391, 6, 31) >> 1) == Parsi::Date.civil(1391, 7, 30)
         
     | 
| 
       10 
8 
     | 
    
         
             
              end
         
     | 
| 
       11 
9 
     | 
    
         | 
| 
       12 
10 
     | 
    
         
             
              it "raise a TypeError when passed a Symbol" do
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
      
 11 
     | 
    
         
            +
                expect { Parsi::Date.civil(1391, 2, 27) >> :hello }.to raise_error(TypeError)
         
     | 
| 
       14 
12 
     | 
    
         
             
              end
         
     | 
| 
       15 
13 
     | 
    
         | 
| 
       16 
14 
     | 
    
         
             
              it "raise a TypeError when passed a String" do
         
     | 
| 
       17 
     | 
    
         
            -
                 
     | 
| 
      
 15 
     | 
    
         
            +
                expect { Parsi::Date.civil(1391, 2, 27) >> "hello" }.to raise_error(TypeError)
         
     | 
| 
       18 
16 
     | 
    
         
             
              end
         
     | 
| 
       19 
17 
     | 
    
         | 
| 
       20 
18 
     | 
    
         
             
              it "raise a TypeError when passed a Parsi::Date" do
         
     | 
| 
       21 
     | 
    
         
            -
                 
     | 
| 
      
 19 
     | 
    
         
            +
                expect { Parsi::Date.civil(1391, 2, 27) >> Parsi::Date.new }.to raise_error(TypeError)
         
     | 
| 
       22 
20 
     | 
    
         
             
              end
         
     | 
| 
       23 
21 
     | 
    
         | 
| 
       24 
22 
     | 
    
         
             
              it "raise a TypeError when passed an Object" do
         
     | 
| 
       25 
     | 
    
         
            -
                 
     | 
| 
      
 23 
     | 
    
         
            +
                expect { Parsi::Date.civil(1391, 2, 27) >> Object.new }.to raise_error(TypeError)
         
     | 
| 
       26 
24 
     | 
    
         
             
              end
         
     | 
| 
       27 
25 
     | 
    
         
             
            end
         
     | 
    
        data/spec/parsi-date/add_spec.rb
    CHANGED
    
    | 
         @@ -1,27 +1,25 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            describe "Parsi::Date#+" do
         
     | 
| 
       2 
2 
     | 
    
         
             
              it "adds the number of days to a Parsi::Date" do
         
     | 
| 
       3 
     | 
    
         
            -
                 
     | 
| 
       4 
     | 
    
         
            -
                d.should == Parsi::Date.civil(1391, 3, 6)
         
     | 
| 
      
 3 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 2, 27) + 10 == Parsi::Date.civil(1391, 3, 6)
         
     | 
| 
       5 
4 
     | 
    
         
             
              end
         
     | 
| 
       6 
5 
     | 
    
         | 
| 
       7 
6 
     | 
    
         
             
              it "adds a negative number of days to a Parsi::Date" do
         
     | 
| 
       8 
     | 
    
         
            -
                 
     | 
| 
       9 
     | 
    
         
            -
                d.should == Parsi::Date.civil(1391, 2, 17)
         
     | 
| 
      
 7 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 2, 27) + (-10) == Parsi::Date.civil(1391, 2, 17)
         
     | 
| 
       10 
8 
     | 
    
         
             
              end
         
     | 
| 
       11 
9 
     | 
    
         | 
| 
       12 
10 
     | 
    
         
             
              it "raises a TypeError when passed a Symbol" do
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
      
 11 
     | 
    
         
            +
                expect { Parsi::Date.civil(1391, 2, 27) + :hello }.to raise_error(TypeError)
         
     | 
| 
       14 
12 
     | 
    
         
             
              end
         
     | 
| 
       15 
13 
     | 
    
         | 
| 
       16 
14 
     | 
    
         
             
              it "raises a TypeError when passed a String" do
         
     | 
| 
       17 
     | 
    
         
            -
                 
     | 
| 
      
 15 
     | 
    
         
            +
                expect { Parsi::Date.civil(1391, 2, 27) + "hello" }.to raise_error(TypeError)
         
     | 
| 
       18 
16 
     | 
    
         
             
              end
         
     | 
| 
       19 
17 
     | 
    
         | 
| 
       20 
18 
     | 
    
         
             
              it "raises a TypeError when passed a Parsi::Date" do
         
     | 
| 
       21 
     | 
    
         
            -
                 
     | 
| 
      
 19 
     | 
    
         
            +
                expect { Parsi::Date.civil(1391, 2, 27) + Parsi::Date.new }.to raise_error(TypeError)
         
     | 
| 
       22 
20 
     | 
    
         
             
              end
         
     | 
| 
       23 
21 
     | 
    
         | 
| 
       24 
22 
     | 
    
         
             
              it "raises a TypeError when passed an Object" do
         
     | 
| 
       25 
     | 
    
         
            -
                 
     | 
| 
      
 23 
     | 
    
         
            +
                expect { Parsi::Date.civil(1391, 2, 27) + Object.new }.to raise_error(TypeError)
         
     | 
| 
       26 
24 
     | 
    
         
             
              end
         
     | 
| 
       27 
25 
     | 
    
         
             
            end
         
     | 
| 
         @@ -2,29 +2,29 @@ require 'date' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            describe "Parsi::Date#<=>" do
         
     | 
| 
       4 
4 
     | 
    
         
             
              it "returns 0 when two dates are equal" do
         
     | 
| 
       5 
     | 
    
         
            -
                (Parsi::Date.civil(1391, 4, 6) <=> Parsi::Date.civil(1391, 4, 6)) 
     | 
| 
       6 
     | 
    
         
            -
                (Parsi::Date.civil(1391, 4, 6) <=> Date.civil(2012, 6, 26)) 
     | 
| 
      
 5 
     | 
    
         
            +
                expect (Parsi::Date.civil(1391, 4, 6) <=> Parsi::Date.civil(1391, 4, 6)) == 0
         
     | 
| 
      
 6 
     | 
    
         
            +
                expect (Parsi::Date.civil(1391, 4, 6) <=> Date.civil(2012, 6, 26)) == 0
         
     | 
| 
       7 
7 
     | 
    
         
             
              end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
              it "returns -1 when self is less than another date" do
         
     | 
| 
       10 
     | 
    
         
            -
                (Parsi::Date.civil(1391, 4, 5) <=> Parsi::Date.civil(1391, 4, 6)) 
     | 
| 
       11 
     | 
    
         
            -
                (Parsi::Date.civil(1391, 4, 5) <=> Date.civil(2012, 6, 26)) 
     | 
| 
      
 10 
     | 
    
         
            +
                expect (Parsi::Date.civil(1391, 4, 5) <=> Parsi::Date.civil(1391, 4, 6)) == -1
         
     | 
| 
      
 11 
     | 
    
         
            +
                expect (Parsi::Date.civil(1391, 4, 5) <=> Date.civil(2012, 6, 26)) == -1
         
     | 
| 
       12 
12 
     | 
    
         
             
              end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
              it "returns 1 when self is greater than another date" do
         
     | 
| 
       15 
     | 
    
         
            -
                (Parsi::Date.civil(1392, 4, 7) <=> Parsi::Date.civil(1391, 4, 6)) 
     | 
| 
       16 
     | 
    
         
            -
                (Parsi::Date.civil(1391, 4, 7) <=> Date.civil(2012, 6, 26)) 
     | 
| 
      
 15 
     | 
    
         
            +
                expect (Parsi::Date.civil(1392, 4, 7) <=> Parsi::Date.civil(1391, 4, 6)) == 1
         
     | 
| 
      
 16 
     | 
    
         
            +
                expect (Parsi::Date.civil(1391, 4, 7) <=> Date.civil(2012, 6, 26)) == 1
         
     | 
| 
       17 
17 
     | 
    
         
             
              end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
              it "returns 0 when self is equal to a Numeric" do
         
     | 
| 
       20 
     | 
    
         
            -
                (Parsi::Date.civil(1391, 4, 6) <=> Rational(4912209,2)) 
     | 
| 
      
 20 
     | 
    
         
            +
                expect (Parsi::Date.civil(1391, 4, 6) <=> Rational(4912209,2)) == 0
         
     | 
| 
       21 
21 
     | 
    
         
             
              end
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
              it "returns -1 when self is less than a Numeric" do
         
     | 
| 
       24 
     | 
    
         
            -
                (Parsi::Date.civil(1391, 4, 6) <=> Rational(4912210,2)) 
     | 
| 
      
 24 
     | 
    
         
            +
                expect (Parsi::Date.civil(1391, 4, 6) <=> Rational(4912210,2)) == -1
         
     | 
| 
       25 
25 
     | 
    
         
             
              end
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
              it "returns 1 when self is greater than a Numeric" do
         
     | 
| 
       28 
     | 
    
         
            -
                (Parsi::Date.civil(1391, 4, 6) <=> Rational(4912208,2)) 
     | 
| 
      
 28 
     | 
    
         
            +
                expect (Parsi::Date.civil(1391, 4, 6) <=> Rational(4912208,2)) == 1
         
     | 
| 
       29 
29 
     | 
    
         
             
              end
         
     | 
| 
       30 
30 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,41 +1,41 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # encoding: utf-8
         
     | 
| 
       2 
2 
     | 
    
         
             
            describe "Date constants" do
         
     | 
| 
       3 
3 
     | 
    
         
             
              it "defines MONTHNAMES" do
         
     | 
| 
       4 
     | 
    
         
            -
                Parsi::Date::MONTHNAMES 
     | 
| 
      
 4 
     | 
    
         
            +
                expect Parsi::Date::MONTHNAMES == [nil] +
         
     | 
| 
       5 
5 
     | 
    
         
             
                  %w(فروردین اردیبهشت خرداد تیر مرداد شهریور مهر آبان آذر دی بهمن اسفند)
         
     | 
| 
       6 
6 
     | 
    
         
             
              end
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
              it "defines EN_MONTHNAMES" do
         
     | 
| 
       9 
     | 
    
         
            -
                Parsi::Date::EN_MONTHNAMES 
     | 
| 
      
 9 
     | 
    
         
            +
                expect Parsi::Date::EN_MONTHNAMES == [nil] +
         
     | 
| 
       10 
10 
     | 
    
         
             
                  %w(farvardin ordibehesht khordad tir mordad shahrivar mehr aban azar day bahman esfand)
         
     | 
| 
       11 
11 
     | 
    
         
             
              end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
              it "defines ABBR_MONTHNAMES" do
         
     | 
| 
       14 
     | 
    
         
            -
                Parsi::Date::ABBR_MONTHNAMES 
     | 
| 
      
 14 
     | 
    
         
            +
                expect Parsi::Date::ABBR_MONTHNAMES == [nil] +
         
     | 
| 
       15 
15 
     | 
    
         
             
                  %w(far ord kho tir mor sha meh abn azr day bah esf)
         
     | 
| 
       16 
16 
     | 
    
         
             
              end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
              it "defines DAYNAMES" do
         
     | 
| 
       19 
     | 
    
         
            -
                Parsi::Date::DAYNAMES 
     | 
| 
      
 19 
     | 
    
         
            +
                expect Parsi::Date::DAYNAMES == %w(یکشنبه دوشنبه سهشنبه چهارشنبه پنجشنبه جمعه شنبه)
         
     | 
| 
       20 
20 
     | 
    
         
             
              end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
              it "defines EN_DAYNAMES" do
         
     | 
| 
       23 
     | 
    
         
            -
                Parsi::Date::EN_DAYNAMES 
     | 
| 
      
 23 
     | 
    
         
            +
                expect Parsi::Date::EN_DAYNAMES == %w(yekshanbe doshanbe seshanbe chaharshanbe panjshanbe jomee shanbe)
         
     | 
| 
       24 
24 
     | 
    
         
             
              end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
              it "defines ABBR_DAYNAMES" do
         
     | 
| 
       27 
     | 
    
         
            -
                Parsi::Date::ABBR_DAYNAMES 
     | 
| 
      
 27 
     | 
    
         
            +
                expect Parsi::Date::ABBR_DAYNAMES == %w(۱ش ۲ش ۳ش ۴ش ۵ش ج ش)
         
     | 
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
              it "defines ABBR_EN_DAYNAMES" do
         
     | 
| 
       31 
     | 
    
         
            -
                Parsi::Date::ABBR_EN_DAYNAMES 
     | 
| 
      
 31 
     | 
    
         
            +
                expect Parsi::Date::ABBR_EN_DAYNAMES == %w(ye do se ch pj jo sh)
         
     | 
| 
       32 
32 
     | 
    
         
             
              end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
              it "freezes MONTHNAMES, DAYNAMES, EN_DAYNAMES, ABBR_MONTHNAMES, ABBR_DAYSNAMES" do
         
     | 
| 
       35 
35 
     | 
    
         
             
                [Parsi::Date::MONTHNAMES, Parsi::Date::EN_MONTHNAMES, Parsi::Date::ABBR_MONTHNAMES,
         
     | 
| 
       36 
36 
     | 
    
         
             
                 Parsi::Date::DAYNAMES, Parsi::Date::EN_DAYNAMES,
         
     | 
| 
       37 
     | 
    
         
            -
                 Parsi::Date::ABBR_DAYNAMES, Parsi::Date::ABBR_EN_DAYNAMES].each do | 
     | 
| 
       38 
     | 
    
         
            -
                   
     | 
| 
      
 37 
     | 
    
         
            +
                 Parsi::Date::ABBR_DAYNAMES, Parsi::Date::ABBR_EN_DAYNAMES].each do |array|
         
     | 
| 
      
 38 
     | 
    
         
            +
                  expect(array).to be_frozen
         
     | 
| 
       39 
39 
     | 
    
         
             
                end
         
     | 
| 
       40 
40 
     | 
    
         
             
              end
         
     | 
| 
       41 
41 
     | 
    
         
             
            end
         
     | 
| 
         @@ -21,35 +21,35 @@ describe Parsi::Date do 
     | 
|
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                it "constructs a Date for 1/1/1 by default" do
         
     | 
| 
       23 
23 
     | 
    
         
             
                  date = Parsi::Date.civil
         
     | 
| 
       24 
     | 
    
         
            -
                  date.year 
     | 
| 
       25 
     | 
    
         
            -
                  date.month 
     | 
| 
       26 
     | 
    
         
            -
                  date.day 
     | 
| 
      
 24 
     | 
    
         
            +
                  expect date.year  == 1
         
     | 
| 
      
 25 
     | 
    
         
            +
                  expect date.month == 1
         
     | 
| 
      
 26 
     | 
    
         
            +
                  expect date.day   == 1
         
     | 
| 
       27 
27 
     | 
    
         
             
                end
         
     | 
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
              context "ordinal" do
         
     | 
| 
       31 
31 
     | 
    
         
             
                it "constructs a Date object from an ordinal date" do
         
     | 
| 
       32 
     | 
    
         
            -
                  Parsi::Date.ordinal(1390) 
     | 
| 
       33 
     | 
    
         
            -
                  Parsi::Date.ordinal(1390,7) 
     | 
| 
       34 
     | 
    
         
            -
                  Parsi::Date.ordinal(1390,100) 
     | 
| 
      
 32 
     | 
    
         
            +
                  expect Parsi::Date.ordinal(1390)       == Parsi::Date.civil(1390, 1, 1)
         
     | 
| 
      
 33 
     | 
    
         
            +
                  expect Parsi::Date.ordinal(1390,7)     == Parsi::Date.civil(1390, 1, 7)
         
     | 
| 
      
 34 
     | 
    
         
            +
                  expect Parsi::Date.ordinal(1390,100)   == Parsi::Date.civil(1390, 4, 7)
         
     | 
| 
       35 
35 
     | 
    
         
             
                end
         
     | 
| 
       36 
36 
     | 
    
         
             
              end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
              context "parse" do
         
     | 
| 
       39 
     | 
    
         
            -
                it " 
     | 
| 
      
 39 
     | 
    
         
            +
                it "parses date from strings" do
         
     | 
| 
       40 
40 
     | 
    
         
             
                  ['1391/8/6', '1391-8-6', '1391 8 6', '1391 8 6', '13910806'].each do |date_string|
         
     | 
| 
       41 
41 
     | 
    
         
             
                    date = Parsi::Date.parse date_string
         
     | 
| 
       42 
     | 
    
         
            -
                    [date.year, date.month, date.day] 
     | 
| 
      
 42 
     | 
    
         
            +
                    expect [date.year, date.month, date.day] == [1391, 8, 6]
         
     | 
| 
       43 
43 
     | 
    
         
             
                  end
         
     | 
| 
       44 
44 
     | 
    
         
             
                end
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
                it "completes century when second arg is true" do
         
     | 
| 
       47 
     | 
    
         
            -
                  Date. 
     | 
| 
      
 47 
     | 
    
         
            +
                  allow(Date).to receive(:today) { Date.new 2012, 10, 26 }
         
     | 
| 
       48 
48 
     | 
    
         
             
                  date = Parsi::Date.parse '91/8/5', true
         
     | 
| 
       49 
     | 
    
         
            -
                  [date.year, date.month, date.day] 
     | 
| 
      
 49 
     | 
    
         
            +
                  expect [date.year, date.month, date.day] == [1391, 8, 5]
         
     | 
| 
       50 
50 
     | 
    
         
             
                end
         
     | 
| 
       51 
51 
     | 
    
         | 
| 
       52 
     | 
    
         
            -
                it " 
     | 
| 
      
 52 
     | 
    
         
            +
                it "raises ArgumentError on invalid date string" do
         
     | 
| 
       53 
53 
     | 
    
         
             
                  expect { date = Parsi::Date.parse '1390/12/30' }.to      raise_error(ArgumentError)
         
     | 
| 
       54 
54 
     | 
    
         
             
                  expect { date = Parsi::Date.parse 'bad date string' }.to raise_error(ArgumentError)
         
     | 
| 
       55 
55 
     | 
    
         
             
                  expect { date = Parsi::Date.parse '12-30-1390' }.to      raise_error(ArgumentError)
         
     | 
| 
         @@ -1,36 +1,36 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            describe "Parsi::Date.jd" do
         
     | 
| 
       2 
2 
     | 
    
         
             
              it "constructs a date form given Chronological Julian day number" do
         
     | 
| 
       3 
     | 
    
         
            -
                Parsi::Date.jd(2456228) 
     | 
| 
       4 
     | 
    
         
            -
                Parsi::Date.jd(2456229) 
     | 
| 
      
 3 
     | 
    
         
            +
                expect Parsi::Date.jd(2456228) == Parsi::Date.civil(1391, 8, 6)
         
     | 
| 
      
 4 
     | 
    
         
            +
                expect Parsi::Date.jd(2456229) == Parsi::Date.civil(1391, 8, 7)
         
     | 
| 
       5 
5 
     | 
    
         
             
              end
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
              it "returns a Date object representing Julian day 0 if no arguments passed"do
         
     | 
| 
       8 
     | 
    
         
            -
                Parsi::Date.jd 
     | 
| 
      
 8 
     | 
    
         
            +
                expect Parsi::Date.jd == Parsi::Date.civil(-5334, 9, 1)
         
     | 
| 
       9 
9 
     | 
    
         
             
              end
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
              it "constructs a Date object if passed a negative number" do
         
     | 
| 
       12 
     | 
    
         
            -
                Parsi::Date.jd(-1) 
     | 
| 
      
 12 
     | 
    
         
            +
                expect Parsi::Date.jd(-1) == Parsi::Date.civil(-5334, 8, 30)
         
     | 
| 
       13 
13 
     | 
    
         
             
              end
         
     | 
| 
       14 
14 
     | 
    
         
             
            end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
16 
     | 
    
         
             
            describe "Parsi::Date#jd" do
         
     | 
| 
       17 
17 
     | 
    
         
             
              it "determines the Julian day for a Date object" do
         
     | 
| 
       18 
     | 
    
         
            -
                Parsi::Date.civil(1391, 8, 7).jd 
     | 
| 
      
 18 
     | 
    
         
            +
                expect Parsi::Date.civil(1391, 8, 7).jd == 2456229
         
     | 
| 
       19 
19 
     | 
    
         
             
              end
         
     | 
| 
       20 
20 
     | 
    
         
             
            end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
            describe "Parsi::Date#to_gregorian" do
         
     | 
| 
       23 
23 
     | 
    
         
             
              it "converts date to Gregorian date" do
         
     | 
| 
       24 
24 
     | 
    
         
             
                date = Parsi::Date.civil(1391, 8, 7).to_gregorian
         
     | 
| 
       25 
     | 
    
         
            -
                date. 
     | 
| 
       26 
     | 
    
         
            -
                date 
     | 
| 
      
 25 
     | 
    
         
            +
                expect(date).to be_a(Date)
         
     | 
| 
      
 26 
     | 
    
         
            +
                expect date == Date.civil(2012, 10, 28)
         
     | 
| 
       27 
27 
     | 
    
         
             
              end
         
     | 
| 
       28 
28 
     | 
    
         
             
            end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
            describe "Date#to_parsi" do
         
     | 
| 
       31 
31 
     | 
    
         
             
              it "converts date to Parsi date" do
         
     | 
| 
       32 
32 
     | 
    
         
             
                date = Date.civil(2012, 10, 28).to_parsi
         
     | 
| 
       33 
     | 
    
         
            -
                date. 
     | 
| 
       34 
     | 
    
         
            -
                date 
     | 
| 
      
 33 
     | 
    
         
            +
                expect(date).to be_a(Parsi::Date)
         
     | 
| 
      
 34 
     | 
    
         
            +
                expect date == Parsi::Date.civil(1391, 8, 7)
         
     | 
| 
       35 
35 
     | 
    
         
             
              end
         
     | 
| 
       36 
36 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,13 +1,15 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            describe "Parsi::Date#leap?" do
         
     | 
| 
       2 
2 
     | 
    
         
             
              it "returns true if a year is a leap year in the Parsi (Jalali) calendar" do
         
     | 
| 
       3 
     | 
    
         
            -
                Parsi::Date.leap?(1387) 
     | 
| 
       4 
     | 
    
         
            -
                Parsi::Date.leap?(1391) 
     | 
| 
       5 
     | 
    
         
            -
                Parsi::Date.leap?(1395) 
     | 
| 
      
 3 
     | 
    
         
            +
                expect Parsi::Date.leap?(1387) == true
         
     | 
| 
      
 4 
     | 
    
         
            +
                expect Parsi::Date.leap?(1391) == true
         
     | 
| 
      
 5 
     | 
    
         
            +
                expect Parsi::Date.leap?(1395) == true
         
     | 
| 
      
 6 
     | 
    
         
            +
                expect Parsi::Date.leap?(1403) == true
         
     | 
| 
       6 
7 
     | 
    
         
             
              end
         
     | 
| 
       7 
8 
     | 
    
         | 
| 
       8 
9 
     | 
    
         
             
              it "returns false if a year is not a leap year in the Parsi (Jalali) calendar" do
         
     | 
| 
       9 
     | 
    
         
            -
                Parsi::Date.leap?(1390) 
     | 
| 
       10 
     | 
    
         
            -
                Parsi::Date.leap?(1392) 
     | 
| 
       11 
     | 
    
         
            -
                Parsi::Date.leap?(1400) 
     | 
| 
      
 10 
     | 
    
         
            +
                expect Parsi::Date.leap?(1390) == false
         
     | 
| 
      
 11 
     | 
    
         
            +
                expect Parsi::Date.leap?(1392) == false
         
     | 
| 
      
 12 
     | 
    
         
            +
                expect Parsi::Date.leap?(1400) == false
         
     | 
| 
      
 13 
     | 
    
         
            +
                expect Parsi::Date.leap?(1404) == false
         
     | 
| 
       12 
14 
     | 
    
         
             
              end
         
     | 
| 
       13 
15 
     | 
    
         
             
            end
         
     | 
| 
         @@ -5,23 +5,23 @@ describe "Parsi::Date#step" do 
     | 
|
| 
       5 
5 
     | 
    
         
             
                de = Parsi::Date.civil(1391, 9, 29)
         
     | 
| 
       6 
6 
     | 
    
         
             
                count = 0
         
     | 
| 
       7 
7 
     | 
    
         
             
                de.step(ds) do |d|
         
     | 
| 
       8 
     | 
    
         
            -
                  d 
     | 
| 
       9 
     | 
    
         
            -
                  d 
     | 
| 
      
 8 
     | 
    
         
            +
                  expect d <= ds
         
     | 
| 
      
 9 
     | 
    
         
            +
                  expect d >= de
         
     | 
| 
       10 
10 
     | 
    
         
             
                  count += 1
         
     | 
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
     | 
    
         
            -
                count 
     | 
| 
      
 12 
     | 
    
         
            +
                expect count == 13
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
                count = 0
         
     | 
| 
       15 
15 
     | 
    
         
             
                de.step(ds, 5) do |d|
         
     | 
| 
       16 
     | 
    
         
            -
                  d 
     | 
| 
       17 
     | 
    
         
            -
                  d 
     | 
| 
      
 16 
     | 
    
         
            +
                  expect d <= ds
         
     | 
| 
      
 17 
     | 
    
         
            +
                  expect d >= de
         
     | 
| 
       18 
18 
     | 
    
         
             
                  count += 1
         
     | 
| 
       19 
19 
     | 
    
         
             
                end
         
     | 
| 
       20 
     | 
    
         
            -
                count 
     | 
| 
      
 20 
     | 
    
         
            +
                expect count == 3
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                count = 0
         
     | 
| 
       23 
23 
     | 
    
         
             
                ds.step(de) do |d|; count += 1; end
         
     | 
| 
       24 
     | 
    
         
            -
                count 
     | 
| 
      
 24 
     | 
    
         
            +
                expect count == 0
         
     | 
| 
       25 
25 
     | 
    
         
             
              end
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
              it "steps backward in time" do
         
     | 
| 
         @@ -29,22 +29,22 @@ describe "Parsi::Date#step" do 
     | 
|
| 
       29 
29 
     | 
    
         
             
                de = Parsi::Date.civil(1390, 3, 29)
         
     | 
| 
       30 
30 
     | 
    
         
             
                count = 0
         
     | 
| 
       31 
31 
     | 
    
         
             
                ds.step(de, -1) do |d|
         
     | 
| 
       32 
     | 
    
         
            -
                  d 
     | 
| 
       33 
     | 
    
         
            -
                  d 
     | 
| 
      
 32 
     | 
    
         
            +
                  expect d <= ds
         
     | 
| 
      
 33 
     | 
    
         
            +
                  expect d >= de
         
     | 
| 
       34 
34 
     | 
    
         
             
                  count += 1
         
     | 
| 
       35 
35 
     | 
    
         
             
                end
         
     | 
| 
       36 
     | 
    
         
            -
                count 
     | 
| 
      
 36 
     | 
    
         
            +
                expect count == 17
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
38 
     | 
    
         
             
                count = 0
         
     | 
| 
       39 
39 
     | 
    
         
             
                ds.step(de, -5) do |d|
         
     | 
| 
       40 
     | 
    
         
            -
                  d 
     | 
| 
       41 
     | 
    
         
            -
                  d 
     | 
| 
      
 40 
     | 
    
         
            +
                  expect d <= ds
         
     | 
| 
      
 41 
     | 
    
         
            +
                  expect d >= de
         
     | 
| 
       42 
42 
     | 
    
         
             
                  count += 1
         
     | 
| 
       43 
43 
     | 
    
         
             
                end
         
     | 
| 
       44 
     | 
    
         
            -
                count 
     | 
| 
      
 44 
     | 
    
         
            +
                expect count == 4
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
                count = 0
         
     | 
| 
       47 
47 
     | 
    
         
             
                de.step(ds, -1) do |d|; count += 1; end
         
     | 
| 
       48 
     | 
    
         
            -
                count 
     | 
| 
      
 48 
     | 
    
         
            +
                expect count == 0
         
     | 
| 
       49 
49 
     | 
    
         
             
              end
         
     | 
| 
       50 
50 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,108 +1,108 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # encoding: utf-8
         
     | 
| 
       2 
2 
     | 
    
         
             
            describe "Parsi::Date#strftime" do
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
              it " 
     | 
| 
       5 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime 
     | 
| 
      
 4 
     | 
    
         
            +
              it "is able to print the date" do
         
     | 
| 
      
 5 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime == "1390/04/06"
         
     | 
| 
       6 
6 
     | 
    
         
             
              end
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
              it " 
     | 
| 
       9 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%A") 
     | 
| 
      
 8 
     | 
    
         
            +
              it "is able to print the full day name" do
         
     | 
| 
      
 9 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%A") == "دوشنبه"
         
     | 
| 
       10 
10 
     | 
    
         
             
              end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
              it " 
     | 
| 
       13 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%a") 
     | 
| 
      
 12 
     | 
    
         
            +
              it "is able to print the short day name" do
         
     | 
| 
      
 13 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%a") == "۲ش"
         
     | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
              it " 
     | 
| 
       17 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%B") 
     | 
| 
       18 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%EB") 
     | 
| 
       19 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%^EB") 
     | 
| 
      
 16 
     | 
    
         
            +
              it "is able to print the full month name" do
         
     | 
| 
      
 17 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%B") == "تیر"
         
     | 
| 
      
 18 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%EB") == "tir"
         
     | 
| 
      
 19 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%^EB") == "Tir"
         
     | 
| 
       20 
20 
     | 
    
         
             
              end
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
              it " 
     | 
| 
       23 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%b") 
     | 
| 
       24 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%h") 
     | 
| 
       25 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%^b") 
     | 
| 
       26 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%^h") 
     | 
| 
       27 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%b") 
     | 
| 
      
 22 
     | 
    
         
            +
              it "is able to print the short month name" do
         
     | 
| 
      
 23 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%b") == "tir"
         
     | 
| 
      
 24 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%h") == "tir"
         
     | 
| 
      
 25 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%^b") == "Tir"
         
     | 
| 
      
 26 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%^h") == "Tir"
         
     | 
| 
      
 27 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%b") == Parsi::Date.civil(1390, 4, 6).strftime("%h")
         
     | 
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
              it " 
     | 
| 
       31 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%C") 
     | 
| 
      
 30 
     | 
    
         
            +
              it "is able to print the century" do
         
     | 
| 
      
 31 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%C") == "13"
         
     | 
| 
       32 
32 
     | 
    
         
             
              end
         
     | 
| 
       33 
33 
     | 
    
         | 
| 
       34 
     | 
    
         
            -
              it " 
     | 
| 
       35 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4,  6).strftime("%d") 
     | 
| 
       36 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 16).strftime("%d") 
     | 
| 
      
 34 
     | 
    
         
            +
              it "is able to print the month day with leading zeroes" do
         
     | 
| 
      
 35 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4,  6).strftime("%d") == "06"
         
     | 
| 
      
 36 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 16).strftime("%d") == "16"
         
     | 
| 
       37 
37 
     | 
    
         
             
              end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
              it " 
     | 
| 
       40 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4,  6).strftime("%-d") 
     | 
| 
       41 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4,  6).strftime("%e") 
     | 
| 
       42 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 16).strftime("%e") 
     | 
| 
      
 39 
     | 
    
         
            +
              it "is able to print the month day with leading spaces and without em" do
         
     | 
| 
      
 40 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4,  6).strftime("%-d") == "6"
         
     | 
| 
      
 41 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4,  6).strftime("%e") == " 6"
         
     | 
| 
      
 42 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 16).strftime("%e") == "16"
         
     | 
| 
       43 
43 
     | 
    
         
             
              end
         
     | 
| 
       44 
44 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
              it " 
     | 
| 
       46 
     | 
    
         
            -
                Parsi::Date.civil(1390,  4, 6).strftime("%m") 
     | 
| 
       47 
     | 
    
         
            -
                Parsi::Date.civil(1390, 11, 6).strftime("%m") 
     | 
| 
       48 
     | 
    
         
            -
                Parsi::Date.civil(1390,  4, 6).strftime("%_m") 
     | 
| 
       49 
     | 
    
         
            -
                Parsi::Date.civil(1390, 11, 6).strftime("%_m") 
     | 
| 
       50 
     | 
    
         
            -
                Parsi::Date.civil(1390,  4, 6).strftime("%-m") 
     | 
| 
       51 
     | 
    
         
            -
                Parsi::Date.civil(1390, 11, 6).strftime("%-m") 
     | 
| 
      
 45 
     | 
    
         
            +
              it "is able to print the month with leading zeroes, spaces and none" do
         
     | 
| 
      
 46 
     | 
    
         
            +
                expect Parsi::Date.civil(1390,  4, 6).strftime("%m") == "04"
         
     | 
| 
      
 47 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 11, 6).strftime("%m") == "11"
         
     | 
| 
      
 48 
     | 
    
         
            +
                expect Parsi::Date.civil(1390,  4, 6).strftime("%_m") == " 4"
         
     | 
| 
      
 49 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 11, 6).strftime("%_m") == "11"
         
     | 
| 
      
 50 
     | 
    
         
            +
                expect Parsi::Date.civil(1390,  4, 6).strftime("%-m") == "4"
         
     | 
| 
      
 51 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 11, 6).strftime("%-m") == "11"
         
     | 
| 
       52 
52 
     | 
    
         
             
              end
         
     | 
| 
       53 
53 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
              it " 
     | 
| 
       55 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%n") 
     | 
| 
      
 54 
     | 
    
         
            +
              it "is able to add a newline" do
         
     | 
| 
      
 55 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%n") == "\n"
         
     | 
| 
       56 
56 
     | 
    
         
             
              end
         
     | 
| 
       57 
57 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
              it " 
     | 
| 
       59 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%t") 
     | 
| 
      
 58 
     | 
    
         
            +
              it "is able to add a tab" do
         
     | 
| 
      
 59 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%t") == "\t"
         
     | 
| 
       60 
60 
     | 
    
         
             
              end
         
     | 
| 
       61 
61 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
              it " 
     | 
| 
       63 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 11).strftime("%w") 
     | 
| 
       64 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 12).strftime("%w") 
     | 
| 
      
 62 
     | 
    
         
            +
              it "is able to show the week day" do
         
     | 
| 
      
 63 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 11).strftime("%w") == "6"
         
     | 
| 
      
 64 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 12).strftime("%w") == "0"
         
     | 
| 
       65 
65 
     | 
    
         
             
              end
         
     | 
| 
       66 
66 
     | 
    
         | 
| 
       67 
     | 
    
         
            -
              it " 
     | 
| 
       68 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 9).strftime("%Y") 
     | 
| 
      
 67 
     | 
    
         
            +
              it "is able to show the year in YYYY format" do
         
     | 
| 
      
 68 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 9).strftime("%Y") == "1390"
         
     | 
| 
       69 
69 
     | 
    
         
             
              end
         
     | 
| 
       70 
70 
     | 
    
         | 
| 
       71 
     | 
    
         
            -
              it " 
     | 
| 
       72 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 9).strftime("%y") 
     | 
| 
      
 71 
     | 
    
         
            +
              it "is able to show the year in YY format" do
         
     | 
| 
      
 72 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 9).strftime("%y") == "90"
         
     | 
| 
       73 
73 
     | 
    
         
             
              end
         
     | 
| 
       74 
74 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
              it " 
     | 
| 
       76 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 9).strftime("%%") 
     | 
| 
      
 75 
     | 
    
         
            +
              it "is able to escape the % character" do
         
     | 
| 
      
 76 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 9).strftime("%%") == "%"
         
     | 
| 
       77 
77 
     | 
    
         
             
              end
         
     | 
| 
       78 
78 
     | 
    
         | 
| 
       79 
79 
     | 
    
         
             
              ############################
         
     | 
| 
       80 
80 
     | 
    
         
             
              # Specs that combine stuff #
         
     | 
| 
       81 
81 
     | 
    
         
             
              ############################
         
     | 
| 
       82 
82 
     | 
    
         | 
| 
       83 
     | 
    
         
            -
              it " 
     | 
| 
       84 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%c") 
     | 
| 
       85 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%c") 
     | 
| 
      
 83 
     | 
    
         
            +
              it "is able to print the date in full" do
         
     | 
| 
      
 84 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%c") == "۲ش 6 تیر 1390"
         
     | 
| 
      
 85 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%c") == Parsi::Date.civil(1390, 4, 6).strftime('%a %-d %B %Y')
         
     | 
| 
       86 
86 
     | 
    
         
             
              end
         
     | 
| 
       87 
87 
     | 
    
         | 
| 
       88 
     | 
    
         
            -
              it " 
     | 
| 
       89 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%D") 
     | 
| 
       90 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%D") 
     | 
| 
      
 88 
     | 
    
         
            +
              it "is able to print the date with slashes" do
         
     | 
| 
      
 89 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%D") == "90/04/06"
         
     | 
| 
      
 90 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%D") == Parsi::Date.civil(1390, 4, 6).strftime('%y/%m/%d')
         
     | 
| 
       91 
91 
     | 
    
         
             
              end
         
     | 
| 
       92 
92 
     | 
    
         | 
| 
       93 
     | 
    
         
            -
              it " 
     | 
| 
       94 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%F") 
     | 
| 
       95 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%F") 
     | 
| 
      
 93 
     | 
    
         
            +
              it "is able to print the date as YYYY-MM-DD" do
         
     | 
| 
      
 94 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%F") == "1390-04-06"
         
     | 
| 
      
 95 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%F") == Parsi::Date.civil(1390, 4, 6).strftime('%Y-%m-%d')
         
     | 
| 
       96 
96 
     | 
    
         
             
              end
         
     | 
| 
       97 
97 
     | 
    
         | 
| 
       98 
     | 
    
         
            -
              it " 
     | 
| 
       99 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 9).strftime("%v") 
     | 
| 
       100 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 9).strftime("%v") 
     | 
| 
      
 98 
     | 
    
         
            +
              it "is able to show the commercial week" do
         
     | 
| 
      
 99 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 9).strftime("%v") == " 9-تیر-1390"
         
     | 
| 
      
 100 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 9).strftime("%v") == Parsi::Date.civil(1390, 4, 9).strftime('%e-%B-%Y')
         
     | 
| 
       101 
101 
     | 
    
         
             
              end
         
     | 
| 
       102 
102 
     | 
    
         | 
| 
       103 
     | 
    
         
            -
              it " 
     | 
| 
       104 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%x") 
     | 
| 
       105 
     | 
    
         
            -
                Parsi::Date.civil(1390, 4, 6).strftime("%x") 
     | 
| 
      
 103 
     | 
    
         
            +
              it "is able to show YY/MM/DD" do
         
     | 
| 
      
 104 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%x") == "90/04/06"
         
     | 
| 
      
 105 
     | 
    
         
            +
                expect Parsi::Date.civil(1390, 4, 6).strftime("%x") == Parsi::Date.civil(1390, 4, 6).strftime('%y/%m/%d')
         
     | 
| 
       106 
106 
     | 
    
         
             
              end
         
     | 
| 
       107 
107 
     | 
    
         | 
| 
       108 
108 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,17 +1,17 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            describe "Parsi::Date#cwday?" do
         
     | 
| 
       2 
2 
     | 
    
         
             
              it "returns the day of calendar week (1-7, Monday is 1)" do
         
     | 
| 
       3 
     | 
    
         
            -
                Parsi::Date.civil(1393, 12, 3).cwday 
     | 
| 
       4 
     | 
    
         
            -
                Parsi::Date.civil(1394,  1, 3).cwday 
     | 
| 
      
 3 
     | 
    
         
            +
                expect Parsi::Date.civil(1393, 12, 3).cwday == 7
         
     | 
| 
      
 4 
     | 
    
         
            +
                expect Parsi::Date.civil(1394,  1, 3).cwday == 1
         
     | 
| 
       5 
5 
     | 
    
         
             
              end
         
     | 
| 
       6 
6 
     | 
    
         
             
            end
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            describe "Parsi::Date#cweek?" do
         
     | 
| 
       9 
9 
     | 
    
         
             
              it "returns the calendar week number (1-53)" do
         
     | 
| 
       10 
     | 
    
         
            -
                Parsi::Date.civil(1393, 11, 30).cweek 
     | 
| 
       11 
     | 
    
         
            -
                Parsi::Date.civil(1393, 12, 1).cweek 
     | 
| 
       12 
     | 
    
         
            -
                Parsi::Date.civil(1393, 12, 29).cweek 
     | 
| 
       13 
     | 
    
         
            -
                Parsi::Date.civil(1394, 1, 1).cweek 
     | 
| 
       14 
     | 
    
         
            -
                Parsi::Date.civil(1394, 1, 7).cweek 
     | 
| 
       15 
     | 
    
         
            -
                Parsi::Date.civil(1394, 1, 8).cweek 
     | 
| 
      
 10 
     | 
    
         
            +
                expect Parsi::Date.civil(1393, 11, 30).cweek == 48
         
     | 
| 
      
 11 
     | 
    
         
            +
                expect Parsi::Date.civil(1393, 12, 1).cweek == 48
         
     | 
| 
      
 12 
     | 
    
         
            +
                expect Parsi::Date.civil(1393, 12, 29).cweek == 52
         
     | 
| 
      
 13 
     | 
    
         
            +
                expect Parsi::Date.civil(1394, 1, 1).cweek == 1
         
     | 
| 
      
 14 
     | 
    
         
            +
                expect Parsi::Date.civil(1394, 1, 7).cweek == 1
         
     | 
| 
      
 15 
     | 
    
         
            +
                expect Parsi::Date.civil(1394, 1, 8).cweek == 2
         
     | 
| 
       16 
16 
     | 
    
         
             
              end
         
     | 
| 
       17 
17 
     | 
    
         
             
            end
         
     | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: parsi-date
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Hassan Zamani
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire: 
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-11-30 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -16,70 +16,70 @@ dependencies: 
     | 
|
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
17 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '2.0'
         
     | 
| 
       20 
20 
     | 
    
         
             
              type: :development
         
     | 
| 
       21 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       22 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       23 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       24 
24 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       25 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       26 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '2.0'
         
     | 
| 
       27 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       28 
28 
     | 
    
         
             
              name: rake
         
     | 
| 
       29 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       30 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
31 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       32 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       33 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '13.0'
         
     | 
| 
       34 
34 
     | 
    
         
             
              type: :development
         
     | 
| 
       35 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
36 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       37 
37 
     | 
    
         
             
                requirements:
         
     | 
| 
       38 
38 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '13.0'
         
     | 
| 
       41 
41 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
42 
     | 
    
         
             
              name: rspec
         
     | 
| 
       43 
43 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       44 
44 
     | 
    
         
             
                requirements:
         
     | 
| 
       45 
45 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       46 
46 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       47 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
       48 
48 
     | 
    
         
             
              type: :development
         
     | 
| 
       49 
49 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       50 
50 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       51 
51 
     | 
    
         
             
                requirements:
         
     | 
| 
       52 
52 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       53 
53 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       54 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '3.0'
         
     | 
| 
       55 
55 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       56 
56 
     | 
    
         
             
              name: activerecord
         
     | 
| 
       57 
57 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       58 
58 
     | 
    
         
             
                requirements:
         
     | 
| 
       59 
59 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       60 
60 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       61 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '6.0'
         
     | 
| 
       62 
62 
     | 
    
         
             
              type: :development
         
     | 
| 
       63 
63 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       64 
64 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       65 
65 
     | 
    
         
             
                requirements:
         
     | 
| 
       66 
66 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       67 
67 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       68 
     | 
    
         
            -
                    version: ' 
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '6.0'
         
     | 
| 
       69 
69 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       70 
70 
     | 
    
         
             
              name: sqlite3
         
     | 
| 
       71 
71 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       72 
72 
     | 
    
         
             
                requirements:
         
     | 
| 
       73 
73 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       74 
74 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       75 
     | 
    
         
            -
                    version: '1. 
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '1.5'
         
     | 
| 
       76 
76 
     | 
    
         
             
              type: :development
         
     | 
| 
       77 
77 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       78 
78 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       79 
79 
     | 
    
         
             
                requirements:
         
     | 
| 
       80 
80 
     | 
    
         
             
                - - "~>"
         
     | 
| 
       81 
81 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       82 
     | 
    
         
            -
                    version: '1. 
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '1.5'
         
     | 
| 
       83 
83 
     | 
    
         
             
            description: A Solar Hijri (Jalali) date library for Ruby, whitch provides much of
         
     | 
| 
       84 
84 
     | 
    
         
             
              Ruby's built-in date class
         
     | 
| 
       85 
85 
     | 
    
         
             
            email: hsn.zamani@gmail.com
         
     | 
| 
         @@ -87,13 +87,12 @@ executables: [] 
     | 
|
| 
       87 
87 
     | 
    
         
             
            extensions: []
         
     | 
| 
       88 
88 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       89 
89 
     | 
    
         
             
            files:
         
     | 
| 
      
 90 
     | 
    
         
            +
            - ".github/workflows/ruby.yml"
         
     | 
| 
       90 
91 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       91 
92 
     | 
    
         
             
            - ".rspec"
         
     | 
| 
       92 
     | 
    
         
            -
            - ".travis.yml"
         
     | 
| 
       93 
93 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       94 
94 
     | 
    
         
             
            - MIT-LICENSE
         
     | 
| 
       95 
95 
     | 
    
         
             
            - README.rdoc
         
     | 
| 
       96 
     | 
    
         
            -
            - TODO
         
     | 
| 
       97 
96 
     | 
    
         
             
            - lib/parsi-date-accessors.rb
         
     | 
| 
       98 
97 
     | 
    
         
             
            - lib/parsi-date.rb
         
     | 
| 
       99 
98 
     | 
    
         
             
            - lib/parsi-datetime.rb
         
     | 
| 
         @@ -116,7 +115,7 @@ homepage: http://github.com/hzamani/parsi-date 
     | 
|
| 
       116 
115 
     | 
    
         
             
            licenses:
         
     | 
| 
       117 
116 
     | 
    
         
             
            - MIT
         
     | 
| 
       118 
117 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       119 
     | 
    
         
            -
            post_install_message: 
     | 
| 
      
 118 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       120 
119 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       121 
120 
     | 
    
         
             
            require_paths:
         
     | 
| 
       122 
121 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -131,9 +130,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       131 
130 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       132 
131 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       133 
132 
     | 
    
         
             
            requirements: []
         
     | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
       135 
     | 
    
         
            -
             
     | 
| 
       136 
     | 
    
         
            -
            signing_key: 
         
     | 
| 
      
 133 
     | 
    
         
            +
            rubygems_version: 3.3.11
         
     | 
| 
      
 134 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       137 
135 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       138 
136 
     | 
    
         
             
            summary: Solar Hijri (Jalali, Persian, Parsi) date library for Ruby
         
     | 
| 
       139 
137 
     | 
    
         
             
            test_files:
         
     | 
| 
         @@ -150,4 +148,3 @@ test_files: 
     | 
|
| 
       150 
148 
     | 
    
         
             
            - spec/parsi-date/strftime_spec.rb
         
     | 
| 
       151 
149 
     | 
    
         
             
            - spec/parsi-date/week_methods_spec.rb
         
     | 
| 
       152 
150 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       153 
     | 
    
         
            -
            has_rdoc: 
         
     | 
    
        data/.travis.yml
    DELETED
    
    
    
        data/TODO
    DELETED
    
    | 
         @@ -1,13 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            (A) Write rdocs
         
     | 
| 
       2 
     | 
    
         
            -
            (A) Fulfill specs
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            Add change log
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
            Add activerecord helper: (maybe it's better to add somewhere else parsi-localize for example)
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            class Product < ActiveRecord::Base
         
     | 
| 
       9 
     | 
    
         
            -
              # this must add :parsi_released_at accessors and sync with original attribute
         
     | 
| 
       10 
     | 
    
         
            -
              has_parsi_date_for :released_at
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              # can have an optional name
         
     | 
| 
       13 
     | 
    
         
            -
              has_parsi_date_for :lifecycel_ended_at, as: 'end_of_life'
         
     |