Module: GyomuRuby::CoreExt::Time::BizYear

Defined in:
lib/gyomu_ruby/core_ext/time/biz_year.rb

Instance Method Summary collapse

Instance Method Details

#biz_year(boundary_mon = 4, boundary_day = 1) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/gyomu_ruby/core_ext/time/biz_year.rb', line 6

def biz_year(boundary_mon = 4, boundary_day = 1)
  now = self
  if (now.month < boundary_mon) || (now.month == boundary_day && now.day == boundary_mon)
    now.year - 1
  else
    now.year
  end
end

#quater?(n) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
# File 'lib/gyomu_ruby/core_ext/time/biz_year.rb', line 15

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