Class: TimeBoss::Calendar::Day
- Inherits:
-
Support::Unit
- Object
- Support::Unit
- TimeBoss::Calendar::Day
- Defined in:
- lib/timeboss/calendar/day.rb
Constant Summary
Constants inherited from Support::Unit
Support::Unit::UnsupportedUnitError
Constants included from Support::Translatable
Support::Translatable::PERIODS
Instance Attribute Summary
Attributes inherited from Support::Unit
#calendar, #end_date, #start_date
Instance Method Summary collapse
-
#index ⇒ Integer
Get the index of this day within its containing year.
-
#initialize(calendar, start_date) ⇒ Day
constructor
A new instance of Day.
-
#name ⇒ String
(also: #to_s)
Get a simple representation of this day.
-
#title ⇒ String
Get a “pretty” representation of this day.
-
#year_index ⇒ Integer
Get the year number for this day.
Methods inherited from Support::Unit
#+, #-, #==, #current?, #dates, #format, #inspect, #offset, #thru, #to_range, type
Methods included from Support::Shiftable
#days_ago, #days_ahead, #halves_ago, #halves_ahead, #in_day, #in_half, #in_month, #in_quarter, #in_week, #in_year, #last_day, #last_half, #last_month, #last_quarter, #last_week, #last_year, #months_ago, #months_ahead, #next_day, #next_half, #next_month, #next_quarter, #next_week, #next_year, #quarters_ago, #quarters_ahead, #this_day, #this_half, #this_month, #this_quarter, #this_week, #this_year, #weeks_ago, #weeks_ahead, #years_ago, #years_ahead
Methods included from Support::Translatable
#day, #days, #half, #halves, #month, #months, #quarter, #quarters, #week, #weeks, #year, #years
Methods included from Support::Navigable
#ago, #ahead, #next, #previous, #until
Constructor Details
#initialize(calendar, start_date) ⇒ Day
Returns a new instance of Day.
8 9 10 |
# File 'lib/timeboss/calendar/day.rb', line 8 def initialize(calendar, start_date) super(calendar, start_date, start_date) end |
Instance Method Details
#index ⇒ Integer
Get the index of this day within its containing year.
28 29 30 |
# File 'lib/timeboss/calendar/day.rb', line 28 def index @_index ||= (start_date - year.start_date).to_i + 1 end |
#name ⇒ String Also known as: to_s
Get a simple representation of this day.
14 15 16 |
# File 'lib/timeboss/calendar/day.rb', line 14 def name start_date.to_s end |
#title ⇒ String
Get a “pretty” representation of this day.
20 21 22 |
# File 'lib/timeboss/calendar/day.rb', line 20 def title start_date.strftime("%B %-d, %Y") end |
#year_index ⇒ Integer
Get the year number for this day.
34 35 36 |
# File 'lib/timeboss/calendar/day.rb', line 34 def year_index @_year_index ||= year.year_index end |