Class: TExp::Year
Instance Method Summary collapse
-
#encode(codes) ⇒ Object
Encode the temporal expression into
codes
. -
#includes?(date) ⇒ Boolean
Is
date
included in the temporal expression. -
#initialize(years) ⇒ Year
constructor
A new instance of Year.
-
#inspect ⇒ Object
Human readable version of the temporal expression.
Methods inherited from Base
#*, #+, #-, #-@, #each, #first_day_of_window, #include?, #last_day_of_window, parse_callback, #reanchor, register_parse_callback, #to_s, #window
Constructor Details
#initialize(years) ⇒ Year
Returns a new instance of Year.
5 6 7 |
# File 'lib/texp/year.rb', line 5 def initialize(years) @years = listize(years) end |
Instance Method Details
#encode(codes) ⇒ Object
Encode the temporal expression into codes
.
20 21 22 23 |
# File 'lib/texp/year.rb', line 20 def encode(codes) encode_list(codes, @years) codes << encoding_token end |
#includes?(date) ⇒ Boolean
Is date
included in the temporal expression.
10 11 12 |
# File 'lib/texp/year.rb', line 10 def includes?(date) @years.include?(date.year) end |
#inspect ⇒ Object
Human readable version of the temporal expression.
15 16 17 |
# File 'lib/texp/year.rb', line 15 def inspect "the year is " + humanize_list(@years) end |