Module: RisingSun::Fiscali::InstanceMethods
- Defined in:
- lib/rising_sun/fiscali.rb
Instance Method Summary collapse
- #beginning_of_financial_half ⇒ Object
- #beginning_of_financial_q2 ⇒ Object
- #beginning_of_financial_q3 ⇒ Object (also: #beginning_of_financial_h2)
- #beginning_of_financial_q4 ⇒ Object
- #beginning_of_financial_quarter ⇒ Object
- #beginning_of_financial_year ⇒ Object (also: #beginning_of_financial_q1, #beginning_of_financial_h1)
- #end_of_financial_q1 ⇒ Object
- #end_of_financial_q2 ⇒ Object (also: #end_of_financial_h1)
- #end_of_financial_q3 ⇒ Object
- #end_of_financial_year ⇒ Object (also: #end_of_financial_q4, #end_of_financial_h2)
- #financial_half ⇒ Object
- #financial_month_of(month) ⇒ Object
- #financial_quarter ⇒ Object
- #financial_year ⇒ Object
- #next_financial_half ⇒ Object
- #next_financial_quarter ⇒ Object
- #previous_financial_half ⇒ Object
- #previous_financial_quarter ⇒ Object
Instance Method Details
#beginning_of_financial_half ⇒ Object
108 109 110 |
# File 'lib/rising_sun/fiscali.rb', line 108 def beginning_of_financial_half beginning_of_financial_year.months_since(((months_between / 6).floor) * 6) end |
#beginning_of_financial_q2 ⇒ Object
61 62 63 |
# File 'lib/rising_sun/fiscali.rb', line 61 def beginning_of_financial_q2 beginning_of_financial_year + 3.months end |
#beginning_of_financial_q3 ⇒ Object Also known as: beginning_of_financial_h2
69 70 71 |
# File 'lib/rising_sun/fiscali.rb', line 69 def beginning_of_financial_q3 beginning_of_financial_year + 6.months end |
#beginning_of_financial_q4 ⇒ Object
77 78 79 |
# File 'lib/rising_sun/fiscali.rb', line 77 def beginning_of_financial_q4 beginning_of_financial_year + 9.months end |
#beginning_of_financial_quarter ⇒ Object
104 105 106 |
# File 'lib/rising_sun/fiscali.rb', line 104 def beginning_of_financial_quarter beginning_of_financial_year.months_since(((months_between / 3).floor) * 3) end |
#beginning_of_financial_year ⇒ Object Also known as: beginning_of_financial_q1, beginning_of_financial_h1
48 49 50 |
# File 'lib/rising_sun/fiscali.rb', line 48 def beginning_of_financial_year change(:year => financial_year, :month => start_month, :day => 1) end |
#end_of_financial_q1 ⇒ Object
57 58 59 |
# File 'lib/rising_sun/fiscali.rb', line 57 def end_of_financial_q1 end_of_financial_year - 9.months end |
#end_of_financial_q2 ⇒ Object Also known as: end_of_financial_h1
65 66 67 |
# File 'lib/rising_sun/fiscali.rb', line 65 def end_of_financial_q2 end_of_financial_year - 6.months end |
#end_of_financial_q3 ⇒ Object
73 74 75 |
# File 'lib/rising_sun/fiscali.rb', line 73 def end_of_financial_q3 end_of_financial_year - 3.months end |
#end_of_financial_year ⇒ Object Also known as: end_of_financial_q4, end_of_financial_h2
52 53 54 |
# File 'lib/rising_sun/fiscali.rb', line 52 def end_of_financial_year (beginning_of_financial_year + 1.year - 1.month).end_of_month end |
#financial_half ⇒ Object
92 93 94 |
# File 'lib/rising_sun/fiscali.rb', line 92 def financial_half "H#{( months_between / 6 ).floor + 1} #{financial_year}" end |
#financial_month_of(month) ⇒ Object
120 121 122 123 124 125 126 |
# File 'lib/rising_sun/fiscali.rb', line 120 def financial_month_of(month) if month < start_month Date.new(year+1,month,1) else Date.new(year,month,1) end end |
#financial_quarter ⇒ Object
88 89 90 |
# File 'lib/rising_sun/fiscali.rb', line 88 def financial_quarter "Q#{( months_between / 3 ).floor + 1} #{financial_year}" end |
#financial_year ⇒ Object
44 45 46 |
# File 'lib/rising_sun/fiscali.rb', line 44 def financial_year self.month < start_month ? self.year - 1 : self.year end |
#next_financial_half ⇒ Object
100 101 102 |
# File 'lib/rising_sun/fiscali.rb', line 100 def next_financial_half beginning_of_financial_year.months_since(((months_between / 6).floor + 1) * 6) end |
#next_financial_quarter ⇒ Object
96 97 98 |
# File 'lib/rising_sun/fiscali.rb', line 96 def next_financial_quarter beginning_of_financial_year.months_since(((months_between / 3).floor + 1 ) * 3) end |
#previous_financial_half ⇒ Object
116 117 118 |
# File 'lib/rising_sun/fiscali.rb', line 116 def previous_financial_half beginning_of_financial_half.months_ago(6) end |
#previous_financial_quarter ⇒ Object
112 113 114 |
# File 'lib/rising_sun/fiscali.rb', line 112 def previous_financial_quarter beginning_of_financial_quarter.months_ago(3) end |