lib/fiscal_year.rb in fiscal_year-0.2.0 vs lib/fiscal_year.rb in fiscal_year-0.3.0

- old
+ new

@@ -9,12 +9,12 @@ require "active_support" require "active_support/core_ext" module FiscalYear + # @type ivar @config: FiscalYear::Config @config ||= FiscalYear::Config.new - class << self attr_reader :config def configure yield(@config) if block_given? @@ -33,17 +33,24 @@ end def cross_year_months return [] if @config.start_month == 1 - months.slice(months.rindex(1), months.length) + rindex = months.rindex(1).to_i + + m = months.slice(rindex, months.length) + raise StandardError if m.nil? + + m end def halfs + # @type self: singleton(FiscalYear) months.in_groups(2) end def quarters + # @type self: singleton(FiscalYear) months.in_groups(4) end end end