class FinancialYear::FinancialYear
Attributes
end_day[RW]
end_month[RW]
start_day[RW]
start_month[RW]
end_date[RW]
start_date[RW]
Public Class Methods
config(start_month=4, start_day=1, end_month=3, end_day=31)
click to toggle source
# File lib/financial_year.rb, line 23 def config(start_month=4, start_day=1, end_month=3, end_day=31) self.start_month = start_month self.start_day = start_day self.end_month = end_month self.end_day= end_day end
for_year(year)
click to toggle source
# File lib/financial_year.rb, line 16 def for_year(year) new( Date.new(year, start_month, start_day), Date.new(year + 1, end_month, end_day) ) end
new(start_date, end_date)
click to toggle source
# File lib/financial_year.rb, line 8 def initialize(start_date, end_date) @start_date = start_date @end_date = end_date end
Public Instance Methods
financial_year_range()
click to toggle source
The range of that financial year
# File lib/financial_year.rb, line 32 def financial_year_range start_date..end_date end
ytd_range()
click to toggle source
From that financial_year to now
# File lib/financial_year.rb, line 37 def ytd_range start_date..Date.today end