Class: MiniDate
- Inherits:
-
Object
- Object
- MiniDate
- Defined in:
- lib/chronic/repeaters/repeater_season.rb
Instance Attribute Summary collapse
-
#day ⇒ Object
Returns the value of attribute day.
-
#month ⇒ Object
Returns the value of attribute month.
Instance Method Summary collapse
- #equals?(other) ⇒ Boolean
-
#initialize(month, day) ⇒ MiniDate
constructor
A new instance of MiniDate.
- #is_between?(md_start, md_end) ⇒ Boolean
Constructor Details
#initialize(month, day) ⇒ MiniDate
Returns a new instance of MiniDate.
28 29 30 31 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 28 def initialize(month, day) @month = month @day = day end |
Instance Attribute Details
#day ⇒ Object
Returns the value of attribute day.
26 27 28 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 26 def day @day end |
#month ⇒ Object
Returns the value of attribute month.
26 27 28 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 26 def month @month end |
Instance Method Details
#equals?(other) ⇒ Boolean
46 47 48 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 46 def equals?(other) @month == other.month and day == other.day end |
#is_between?(md_start, md_end) ⇒ Boolean
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/chronic/repeaters/repeater_season.rb', line 33 def is_between?(md_start, md_end) return true if (@month == md_start.month and @day >= md_start.day) || (@month == md_end.month and @day <= md_end.day) i = md_start.month + 1 until i == md_end.month return true if @month == i i = (i+1) % 12 end return false end |