Class: Runt::YearTE

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

Overview

Simple expression which returns true if the supplied arguments occur within the given year.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TExpr

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

Constructor Details

#initialize(year) ⇒ YearTE

Returns a new instance of YearTE.



933
934
935
# File 'lib/runt/temporalexpression.rb', line 933

def initialize(year)
  @year = year
end

Instance Attribute Details

#yearObject (readonly)

Returns the value of attribute year.



931
932
933
# File 'lib/runt/temporalexpression.rb', line 931

def year
  @year
end

Instance Method Details

#==(o) ⇒ Object



937
938
939
# File 'lib/runt/temporalexpression.rb', line 937

def ==(o)
  o.is_a?(YearTE) ? year == o.year  : super(o)
end

#include?(date) ⇒ Boolean

Returns:

  • (Boolean)


941
942
943
# File 'lib/runt/temporalexpression.rb', line 941

def include?(date)
  return date.year == @year
end

#to_sObject



945
946
947
# File 'lib/runt/temporalexpression.rb', line 945

def to_s
  "during the year #{@year}"
end