Sha256: 10aae97f1ea2a8fb7d1bc2772a1e7968ee07577195563c60a8f9808e698df84a

Contents?: true

Size: 598 Bytes

Versions: 1

Compression:

Stored size: 598 Bytes

Contents

#coding: utf-8
module GyomuRuby
  module CoreExt
    module Time
      module BizYear
        def biz_year(boundary_mon = 4, boundary_day = 1)
          now = self
          if (now.month < boundary_mon) || (now.month == boundary_mon && now.day < boundary_day)
            now.year - 1
          else
            now.year
          end
        end

        def quater?(n)
          n == case self.month
               when 4..6   then 1
               when 7..9   then 2
               when 10..12 then 3
               when 1..3   then 4
               end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gyomu_ruby-0.0.4 lib/gyomu_ruby/core_ext/time/biz_year.rb