Class: TExp::SingleTermBase
Overview
Base class for temporal expressions with a single sub-expressions (i.e. term).
Instance Method Summary collapse
-
#each {|@term| ... } ⇒ Object
Iterate over all temporal expressions and subexpressions (in post order).
-
#initialize(term) ⇒ SingleTermBase
constructor
Create a single term temporal expression.
-
#reanchor(date) ⇒ Object
Create a new temporal expression with a new anchor date.
Methods inherited from Base
#*, #+, #-, #-@, #first_day_of_window, #include?, #last_day_of_window, parse_callback, register_parse_callback, #to_s, #window
Constructor Details
#initialize(term) ⇒ SingleTermBase
Create a single term temporal expression.
230 231 232 |
# File 'lib/texp/base.rb', line 230 def initialize(term) @term = term end |
Instance Method Details
#each {|@term| ... } ⇒ Object
Iterate over all temporal expressions and subexpressions (in post order).
242 243 244 245 |
# File 'lib/texp/base.rb', line 242 def each() # :yield: temporal_expression yield @term yield self end |
#reanchor(date) ⇒ Object
Create a new temporal expression with a new anchor date.
235 236 237 238 |
# File 'lib/texp/base.rb', line 235 def reanchor(date) new_term = @term.reanchor(date) (@term == new_term) ? self : self.class.new(new_term) end |