Class: Chronic::MiniDate

Inherits:
Object
  • Object
show all
Defined in:
lib/chronic/repeaters/repeater_season.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dayObject

Returns the value of attribute day.



26
27
28
# File 'lib/chronic/repeaters/repeater_season.rb', line 26

def day
  @day
end

#monthObject

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

Returns:

  • (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

Returns:

  • (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