enum

Time::DayOfWeek

Inherits Enum / Comparable / Value / Object

DayOfWeek represents a day of the week in the Gregorian calendar.

time = Time.local(2016, 2, 15)
time.day_of_week # => Time::DayOfWeek::Monday

Each member is identified by its ordinal number starting from Monday = 1 according to ISO 8601.

#value returns this ordinal number. It can easily be converted to the also common numbering based on Sunday = 0 using value % 7.

Constants

Monday = 1
Tuesday = 2
Wednesday = 3
Thursday = 4
Friday = 5
Saturday = 6
Sunday = 7

Constructors

from_value(value : Int32) : self

Returns the day of week that has the given value, or raises if no such member exists.

This method also accepts 0 to identify Sunday in order to be compliant with the Sunday = 0 numbering. All other days are equal in both formats.

Source

Instance methods

friday?

Returns true if this enum value equals Friday

Source
monday?

Returns true if this enum value equals Monday

Source
saturday?

Returns true if this enum value equals Saturday

Source
sunday?

Returns true if this enum value equals Sunday

Source
thursday?

Returns true if this enum value equals Thursday

Source
tuesday?

Returns true if this enum value equals Tuesday

Source
wednesday?

Returns true if this enum value equals Wednesday

Source