fyuk 0.6.4 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
 - data/fyuk.gemspec +1 -1
 - data/lib/uk_financial_year.rb +12 -12
 - metadata +2 -2
 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.6. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.6.5
         
     | 
    
        data/fyuk.gemspec
    CHANGED
    
    
    
        data/lib/uk_financial_year.rb
    CHANGED
    
    | 
         @@ -33,18 +33,6 @@ class UkFinancialYear 
     | 
|
| 
       33 
33 
     | 
    
         
             
                new(Date.new s.to(3).to_i, 4, 6)
         
     | 
| 
       34 
34 
     | 
    
         
             
              end
         
     | 
| 
       35 
35 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
              def self.check_format s
         
     | 
| 
       37 
     | 
    
         
            -
                if /^(?<year1>\d{4})\/(?<year2>\d{2})$/ =~ s
         
     | 
| 
       38 
     | 
    
         
            -
                  year1 = year1.to_i
         
     | 
| 
       39 
     | 
    
         
            -
                  year1_century = year1 / 100
         
     | 
| 
       40 
     | 
    
         
            -
                  year2_century = year1 % 100 == 99 ? year1_century + 1 : year1_century
         
     | 
| 
       41 
     | 
    
         
            -
                  year2 = year2_century * 100 + year2.to_i
         
     | 
| 
       42 
     | 
    
         
            -
                  raise %{"#{year1}" and "#{year2}" are not consecutive years} unless year1 + 1 == year2
         
     | 
| 
       43 
     | 
    
         
            -
                else
         
     | 
| 
       44 
     | 
    
         
            -
                  raise %{"#{s}" does not match FY string format}
         
     | 
| 
       45 
     | 
    
         
            -
                end
         
     | 
| 
       46 
     | 
    
         
            -
              end
         
     | 
| 
       47 
     | 
    
         
            -
             
     | 
| 
       48 
36 
     | 
    
         
             
              # returns the date of the first day of the financial year
         
     | 
| 
       49 
37 
     | 
    
         
             
              # @return [Date] the first day
         
     | 
| 
       50 
38 
     | 
    
         
             
              def first_day
         
     | 
| 
         @@ -122,6 +110,18 @@ class UkFinancialYear 
     | 
|
| 
       122 
110 
     | 
    
         
             
                  date < swap_date_that_year ? swap_date_that_year.prev_year : swap_date_that_year
         
     | 
| 
       123 
111 
     | 
    
         
             
                end
         
     | 
| 
       124 
112 
     | 
    
         | 
| 
      
 113 
     | 
    
         
            +
                def self.check_format s
         
     | 
| 
      
 114 
     | 
    
         
            +
                  if /^(?<year1>\d{4})\/(?<year2>\d{2})$/ =~ s
         
     | 
| 
      
 115 
     | 
    
         
            +
                    year1 = year1.to_i
         
     | 
| 
      
 116 
     | 
    
         
            +
                    year1_century = year1 / 100
         
     | 
| 
      
 117 
     | 
    
         
            +
                    year2_century = year1 % 100 == 99 ? year1_century + 1 : year1_century
         
     | 
| 
      
 118 
     | 
    
         
            +
                    year2 = year2_century * 100 + year2.to_i
         
     | 
| 
      
 119 
     | 
    
         
            +
                    raise %{"#{year1}" and "#{year2}" are not consecutive years} unless year1 + 1 == year2
         
     | 
| 
      
 120 
     | 
    
         
            +
                  else
         
     | 
| 
      
 121 
     | 
    
         
            +
                    raise %{"#{s}" does not match FY string format}
         
     | 
| 
      
 122 
     | 
    
         
            +
                  end
         
     | 
| 
      
 123 
     | 
    
         
            +
                end
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
       125 
125 
     | 
    
         
             
                def date_to_compare other
         
     | 
| 
       126 
126 
     | 
    
         
             
                  other.is_a?(Date) ? other : other.first_day
         
     | 
| 
       127 
127 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: fyuk
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.6. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.6.5
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -176,7 +176,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       176 
176 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       177 
177 
     | 
    
         
             
                  segments:
         
     | 
| 
       178 
178 
     | 
    
         
             
                  - 0
         
     | 
| 
       179 
     | 
    
         
            -
                  hash: - 
     | 
| 
      
 179 
     | 
    
         
            +
                  hash: -1066897339467518429
         
     | 
| 
       180 
180 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       181 
181 
     | 
    
         
             
              none: false
         
     | 
| 
       182 
182 
     | 
    
         
             
              requirements:
         
     |