Class: TExp::And
- Inherits:
-
MultiTermBase
- Object
- Base
- MultiTermBase
- TExp::And
- Defined in:
- lib/texp/logic.rb
Overview
Logically AND a list of temporal expressions. A date is included only if it is included in all of the sub-expressions.
Direct Known Subclasses
Instance Method Summary collapse
-
#encode(codes) ⇒ Object
Encode the temporal expression into
codes
. -
#includes?(date) ⇒ Boolean
Is
date
included in the temporal expression. -
#inspect ⇒ Object
Human readable version of the temporal expression.
Methods inherited from MultiTermBase
#each, #initialize, parse_callback, #reanchor
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
This class inherits a constructor from TExp::MultiTermBase
Instance Method Details
#encode(codes) ⇒ Object
Encode the temporal expression into codes
.
20 21 22 23 |
# File 'lib/texp/logic.rb', line 20 def encode(codes) encode_list(codes, @terms) codes << encoding_token end |
#includes?(date) ⇒ Boolean
Is date
included in the temporal expression.
10 11 12 |
# File 'lib/texp/logic.rb', line 10 def includes?(date) @terms.all? { |te| te.includes?(date) } end |
#inspect ⇒ Object
Human readable version of the temporal expression.
15 16 17 |
# File 'lib/texp/logic.rb', line 15 def inspect humanize_list(@terms, "and") { |item| item.inspect } end |