Class: ConceptQL::Nodes::TimeWindow

Inherits:
Node
  • Object
show all
Defined in:
lib/conceptql/nodes/time_window.rb

Overview

A TimeWindow adjusts the start_date and end_date the incoming stream by the values specified in the start and end arguments.

Start and end take the format of ([+-]d*)+. For example: ‘d’ => adjust date by one day. 2012-10-07 => 2012-10-08 ‘m’ => adjust date by one month. 2012-10-07 => 2012-11-07 ‘y’ => adjust date by one year. 2012-10-07 => 2013-10-07 ‘1y’ => adjust date by one year. 2012-10-07 => 2013-10-07 ‘1d1y’ => adjust date by one day and one year. 2012-10-07 => 2013-10-08 ‘-1d’ => adjust date by negative one day. 2012-10-07 => 2012-10-06 ‘-1d1y’ => adjust date by negative one day and positive one year. 2012-10-07 => 2013-10-06 ”, ‘0’, nil => don’t adjust date at all

Both start and end arguments must be provided, but if you do not wish to adjust a date just pass ”, ‘0’, or nil as that argument. E.g.: start: ‘d’, end: ” # Only adjust start_date by positive 1 day and leave end_date uneffected

Constant Summary

Constants inherited from Node

Node::KNOWN_TYPES

Instance Attribute Summary

Attributes inherited from Node

#values

Instance Method Summary collapse

Methods inherited from Node

#arguments, #children, #columns, #evaluate, #initialize, #select_it, #stream, #types

Constructor Details

This class inherits a constructor from ConceptQL::Nodes::Node

Instance Method Details

#query(db) ⇒ Object



23
24
25
# File 'lib/conceptql/nodes/time_window.rb', line 23

def query(db)
  db.from(stream.evaluate(db))
end