lib/fat_period/period.rb
# Return a string name for this period based solely on the number of days in
# the period. Any period sufficiently close to 30 days will return the string
# 'Month', and any period sufficiently close to 90 days will return 'Quarter'.
# However for the shorter periods, periods less than month, no tolerance is
# applied.  The amount of tolerance for the longer periods can be controlled
# with the `tolerance_pct` parameter, which default to 10%.  If no calendar
# period corresponds to the length of the period, return 'Period'.
#
# @example
#   Period.new('2015-05-15', '2015-06-17').chunk_name    #=> 'Month' (within 10%)
#   Period.new('2015-05-15', '2015-06-17').chunk_name(8) #=> 'Period' (but not 8%)
#
# @param tolerance_pct [Numeric] long period tolerance as a percent, 10 by default
# @return [String] the name for this period based solely on the number of days
#   in the period.
Return a string name for this period based solely on the number of days in
the period. Any period sufficiently close to 30 days will return the string
'Month', and any period sufficiently close to 90 days will return 'Quarter'.
However for the shorter periods, periods less than month, no tolerance is
applied.  The amount of tolerance for the longer periods can be controlled
with the `tolerance_pct` parameter, which default to 10%.  If no calendar
period corresponds to the length of the period, return 'Period'.
Return a string name for this period based solely on the number of days in the period . Any period sufficiently close to 30 days will return the string ' Month ' and any period sufficiently close to 90 days will return ' Quarter ' . However for the shorter periods periods less than month no tolerance is applied . The amount of tolerance for the longer periods can be controlled with the ` tolerance_pct ` parameter which default to 10% . If no calendar period corresponds to the length of the period return ' Period ' .
def chunk_name(tolerance_pct = 10)
    case Period.days_to_chunk(length, tolerance_pct)
    when :year
      'Year'
    when :half
      'Half'
    when :quarter
      'Quarter'
    when :bimonth
      'Bimonth'
    when :month
      'Month'
    when :semimonth
      'Semimonth'
    when :biweek
      'Biweek'
    when :week
      'Week'
    when :day
      'Day'
    else
      'Period'
    end
  end
def chunk_name ( tolerance_pct = 10 ) case Period . days_to_chunk ( length , tolerance_pct ) when :year 'Year' when :half 'Half' when :quarter 'Quarter' when :bimonth 'Bimonth' when :month 'Month' when :semimonth 'Semimonth' when :biweek 'Biweek' when :week 'Week' when :day 'Day' else 'Period' end end
Return a string name for this period based solely on the number of days in
the period.
Return a string name for this period based solely on the number of days in the period .
the name for this period based solely on the number of days in the period.
the name for this period based solely on the number of days in the period .
String
tolerance_pct
long period tolerance as a percent, 10 by default
long period tolerance as a percent 10 by default
example
None