Class: Runt::RSpec

Inherits:
Spec
  • Object
show all
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 Spec

#date_expr

Instance Method Summary collapse

Methods inherited from Spec

#initialize, #to_s

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

Returns:

  • (Boolean)


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

Returns:

  • (Boolean)


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