Class: RemLint::CalendarDate
- Inherits:
-
Struct
- Object
- Struct
- RemLint::CalendarDate
- Includes:
- Comparable
- Defined in:
- lib/remlint/date_literal.rb
Overview
A fully-specified date written out in a trigger.
Remind accepts the three components in any order -- 1 Jan 2027,
Jan 1 2027 and 2027 Jan 1 are the same date to GetFullDate -- so this
collects components rather than matching a shape.
Instance Attribute Summary collapse
-
#day ⇒ Object
Returns the value of attribute day.
-
#month ⇒ Object
Returns the value of attribute month.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#to_i ⇒ Object
Days from 1990-01-01, the same epoch Remind counts from (
BASEin src/custom.h.in). - #to_s ⇒ Object
Instance Attribute Details
#day ⇒ Object
Returns the value of attribute day
11 12 13 |
# File 'lib/remlint/date_literal.rb', line 11 def day @day end |
#month ⇒ Object
Returns the value of attribute month
11 12 13 |
# File 'lib/remlint/date_literal.rb', line 11 def month @month end |
#year ⇒ Object
Returns the value of attribute year
11 12 13 |
# File 'lib/remlint/date_literal.rb', line 11 def year @year end |
Instance Method Details
#<=>(other) ⇒ Object
28 29 30 |
# File 'lib/remlint/date_literal.rb', line 28 def <=>(other) to_i <=> other.to_i end |
#to_i ⇒ Object
Days from 1990-01-01, the same epoch Remind counts from (BASE in
src/custom.h.in). Only ever compared against another one of these, so it
needs to be monotonic rather than meaningful.
15 16 17 |
# File 'lib/remlint/date_literal.rb', line 15 def to_i (year * 10_000) + (month * 100) + day end |
#to_s ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/remlint/date_literal.rb', line 19 def to_s format( "%04d-%02d-%02d", year, month, day, ) end |