Class: Runt::TemporalDate

Inherits:
Object
  • Object
show all
Includes:
TExpr
Defined in:
lib/runt/temporalexpression.rb

Overview

TExpr that provides for inclusion of an arbitrary date.

Direct Known Subclasses

TemporalRange

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TExpr

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

Constructor Details

#initialize(date_expr) ⇒ TemporalDate

Returns a new instance of TemporalDate.



216
217
218
# File 'lib/runt/temporalexpression.rb', line 216

def initialize(date_expr)
  @date_expr = date_expr
end

Instance Attribute Details

#date_exprObject (readonly)

Returns the value of attribute date_expr.



214
215
216
# File 'lib/runt/temporalexpression.rb', line 214

def date_expr
  @date_expr
end

Instance Method Details

#==(o) ⇒ Object



220
221
222
# File 'lib/runt/temporalexpression.rb', line 220

def ==(o)
  o.is_a?(TemporalDate) ? date_expr == o.date_expr : super(o)
end

#include?(date_expr) ⇒ Boolean

Will return true if the supplied object is == to that which was used to create this instance

Returns:

  • (Boolean)


226
227
228
229
230
# File 'lib/runt/temporalexpression.rb', line 226

def include?(date_expr)
  return date_expr.include?(@date_expr) if date_expr.respond_to?(:include?)
  return true if @date_expr == date_expr
  false
end

#to_sObject



232
233
234
# File 'lib/runt/temporalexpression.rb', line 232

def to_s
  @date_expr.to_s
end