Class: TExp::Or

Inherits:
MultiTermBase show all
Defined in:
lib/texp/logic.rb

Overview

Logically OR a list of temporal expressions. A date is included if it is included in any of the sub-expressions.

Instance Method Summary collapse

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.



43
44
45
46
# File 'lib/texp/logic.rb', line 43

def encode(codes)
  encode_list(codes, @terms)
  codes << encoding_token
end

#includes?(date) ⇒ Boolean

Is date included in the temporal expression.

Returns:

  • (Boolean)


33
34
35
# File 'lib/texp/logic.rb', line 33

def includes?(date)
  @terms.any? { |te| te.includes?(date) }
end

#inspectObject

Human readable version of the temporal expression.



38
39
40
# File 'lib/texp/logic.rb', line 38

def inspect
  humanize_list(@terms) { |item| item.inspect }
end