Class: Runt::RSpec

Inherits:
TExpr
  • 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 Method Summary collapse

Methods inherited from TExpr

#&, #-, #and, #minus, #or, #|

Constructor Details

#initialize(date_expr) ⇒ RSpec

Returns a new instance of RSpec.

Raises:

  • (TypeError)


192
193
194
195
# File 'lib/runt/temporalexpression.rb', line 192

def initialize(date_expr)
  raise TypeError, 'expected range' unless date_expr.kind_of?(Range)
  @date_expr = date_expr
end

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)


199
200
201
# File 'lib/runt/temporalexpression.rb', line 199

def include?(date_expr)
  return @date_expr.include?(date_expr)
end

#to_sObject



203
# File 'lib/runt/temporalexpression.rb', line 203

def to_s; "RSpec" end