Class: Runt::RSpec
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 Spec
Instance Method Summary collapse
-
#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 Spec
Methods included from TExpr
#&, #-, #and, #dates, #minus, #or, #to_s, #|
Constructor Details
This class inherits a constructor from Runt::Spec
Instance Method Details
#include?(date_expr) ⇒ Boolean
Will return true if the supplied object is included in the range used to create this instance
224 225 226 |
# File 'lib/runt/temporalexpression.rb', line 224 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
230 231 232 233 234 235 |
# File 'lib/runt/temporalexpression.rb', line 230 def overlap?(date_expr) @date_expr.each do | interval | return true if date_expr.include?(interval) end false end |