Class: DurationRange::Date

Inherits:
Object
  • Object
show all
Includes:
CommonFunctions
Defined in:
lib/duration_range/date.rb

Instance Attribute Summary

Attributes included from CommonFunctions

#today

Instance Method Summary collapse

Methods included from CommonFunctions

#initialize, #modes, #month_as_date, #months_as_date, #this_month_as_date, #tidy_with_date

Instance Method Details

#last_month(as: :array, count: 1) ⇒ Object

Parameters:

  • as (Symbol) (defaults to: :array)
  • count (Integer) (defaults to: 1)

Returns:

  • (Object)


54
55
56
# File 'lib/duration_range/date.rb', line 54

def last_month(as: :array, count: 1)
  super(as: as, count: count)
end

#last_week(as: :array, count: 1) ⇒ Object

Parameters:

  • as (Symbol) (defaults to: :array)
  • count (Integer) (defaults to: 1)

Returns:

  • (Object)


81
82
83
# File 'lib/duration_range/date.rb', line 81

def last_week(as: :array, count: 1)
  super(as: as, count: count)
end

#month(month, as: :array) ⇒ Object

generate specific month duration (e.g. 2021-04)

Parameters:

  • month (String)
  • as (Symbol) (defaults to: :array)

Returns:

  • (Object)


16
17
18
# File 'lib/duration_range/date.rb', line 16

def month(month, as: :array)
  month_as_date(month, as: as)
end

#months(*months, as: :array) ⇒ Object

longest duration from multiple months

Parameters:

  • months (Array)
  • as (Symbol) (defaults to: :array)

Returns:

  • (Object)


27
28
29
# File 'lib/duration_range/date.rb', line 27

def months(*months, as: :array)
  months_as_date(*months, as: as)
end

#next_month(as: :array, count: 1) ⇒ Object

Parameters:

  • as (Symbol) (defaults to: :array)
  • count (Integer) (defaults to: 1)

Returns:

  • (Object)


45
46
47
# File 'lib/duration_range/date.rb', line 45

def next_month(as: :array, count: 1)
  super(as: as, count: count)
end

#next_week(as: :array, count: 1) ⇒ Object

Parameters:

  • as (Symbol) (defaults to: :array)
  • count (Integer) (defaults to: 1)

Returns:

  • (Object)


72
73
74
# File 'lib/duration_range/date.rb', line 72

def next_week(as: :array, count: 1)
  super(as: as, count: count)
end

#this_month(as: :array, reference_date: today) ⇒ Object

Parameters:

  • as (Symbol) (defaults to: :array)
  • reference_date (Date) (defaults to: today)

Returns:

  • (Object)


36
37
38
# File 'lib/duration_range/date.rb', line 36

def this_month(as: :array, reference_date: today)
  this_month_as_date(as: as, reference_date: reference_date)
end

#this_week(as: :array, reference_date: today) ⇒ Object

Parameters:

  • as (Symbol) (defaults to: :array)
  • reference_date (Date) (defaults to: today)

Returns:

  • (Object)


63
64
65
# File 'lib/duration_range/date.rb', line 63

def this_week(as: :array, reference_date: today)
  super(as: as, reference_date: reference_date)
end