Class: TExp::Month
Instance Method Summary collapse
-
#encode(codes) ⇒ Object
Encode the temporal expression into
codes
. -
#includes?(date) ⇒ Boolean
Is
date
included in the temporal expression. -
#initialize(months) ⇒ Month
constructor
A new instance of Month.
-
#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(months) ⇒ Month
Returns a new instance of Month.
5 6 7 |
# File 'lib/texp/month.rb', line 5 def initialize(months) @months = listize(months) end |
Instance Method Details
#encode(codes) ⇒ Object
Encode the temporal expression into codes
.
21 22 23 24 |
# File 'lib/texp/month.rb', line 21 def encode(codes) encode_list(codes, @months) codes << encoding_token end |
#includes?(date) ⇒ Boolean
Is date
included in the temporal expression.
10 11 12 |
# File 'lib/texp/month.rb', line 10 def includes?(date) @months.include?(date.month) end |
#inspect ⇒ Object
Human readable version of the temporal expression.
15 16 17 18 |
# File 'lib/texp/month.rb', line 15 def inspect "the month is " + humanize_list(@months) { |m| Date::MONTHNAMES[m] } end |