Class: Runt::YearTE
- Inherits:
-
Object
- Object
- Runt::YearTE
- 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
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
- #==(o) ⇒ Object
- #include?(date) ⇒ Boolean
-
#initialize(year) ⇒ YearTE
constructor
A new instance of YearTE.
- #to_s ⇒ Object
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
#year ⇒ Object (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
941 942 943 |
# File 'lib/runt/temporalexpression.rb', line 941 def include?(date) return date.year == @year end |
#to_s ⇒ Object
945 946 947 |
# File 'lib/runt/temporalexpression.rb', line 945 def to_s "during the year #{@year}" end |