Class: Runt::TemporalRange
- Inherits:
-
TemporalDate
- Object
- TemporalDate
- Runt::TemporalRange
- Defined in:
- lib/runt/temporalexpression.rb
Overview
TExpr that provides a thin wrapper around built-in Ruby Range
functionality facilitating inclusion of an arbitrary range in a temporal expression.
See also: Range
Instance Attribute Summary
Attributes inherited from TemporalDate
Instance Method Summary collapse
- #==(o) ⇒ Object
-
#include?(date_expr) ⇒ Boolean
Will return true if the supplied object is included in the range used to create this instance.
-
#overlap?(date_expr) ⇒ Boolean
Will return true if the supplied object overlaps with the range used to create this instance.
Methods inherited from TemporalDate
Methods included from TExpr
#&, #-, #and, #dates, #minus, #or, #to_s, #|
Constructor Details
This class inherits a constructor from Runt::TemporalDate
Instance Method Details
#==(o) ⇒ Object
250 251 252 |
# File 'lib/runt/temporalexpression.rb', line 250 def ==(o) o.is_a?(TemporalRange) ? date_expr == o.date_expr : super(o) end |
#include?(date_expr) ⇒ Boolean
Will return true if the supplied object is included in the range used to create this instance
246 247 248 |
# File 'lib/runt/temporalexpression.rb', line 246 def include?(date_expr) return @date_expr.include?(date_expr) end |
#overlap?(date_expr) ⇒ Boolean
Will return true if the supplied object overlaps with the range used to create this instance
256 257 258 259 260 261 |
# File 'lib/runt/temporalexpression.rb', line 256 def overlap?(date_expr) @date_expr.each do | interval | return true if date_expr.include?(interval) end false end |