Class: Zmanim::Limudim::Anchor::DayOfMonthAnchor
- Inherits:
-
Object
- Object
- Zmanim::Limudim::Anchor::DayOfMonthAnchor
- Defined in:
- lib/zmanim/limudim/anchor/day_of_month_anchor.rb
Instance Attribute Summary collapse
-
#day ⇒ Object
readonly
Returns the value of attribute day.
Instance Method Summary collapse
- #current_or_previous_occurrence(jewish_date) ⇒ Object
-
#initialize(day) ⇒ DayOfMonthAnchor
constructor
A new instance of DayOfMonthAnchor.
- #next_occurrence(jewish_date) ⇒ Object
- #previous_occurrence(jewish_date) ⇒ Object
Constructor Details
#initialize(day) ⇒ DayOfMonthAnchor
4 5 6 |
# File 'lib/zmanim/limudim/anchor/day_of_month_anchor.rb', line 4 def initialize(day) @day = day end |
Instance Attribute Details
#day ⇒ Object (readonly)
Returns the value of attribute day.
3 4 5 |
# File 'lib/zmanim/limudim/anchor/day_of_month_anchor.rb', line 3 def day @day end |
Instance Method Details
#current_or_previous_occurrence(jewish_date) ⇒ Object
20 21 22 23 24 |
# File 'lib/zmanim/limudim/anchor/day_of_month_anchor.rb', line 20 def current_or_previous_occurrence(jewish_date) occurrence = Zmanim::HebrewCalendar::JewishDate.new(jewish_date.jewish_year, jewish_date.jewish_month, day) decrement_month(occurrence) if occurrence > jewish_date occurrence end |
#next_occurrence(jewish_date) ⇒ Object
8 9 10 11 12 |
# File 'lib/zmanim/limudim/anchor/day_of_month_anchor.rb', line 8 def next_occurrence(jewish_date) occurrence = Zmanim::HebrewCalendar::JewishDate.new(jewish_date.jewish_year, jewish_date.jewish_month, day) increment_month(occurrence) if occurrence <= jewish_date occurrence end |
#previous_occurrence(jewish_date) ⇒ Object
14 15 16 17 18 |
# File 'lib/zmanim/limudim/anchor/day_of_month_anchor.rb', line 14 def previous_occurrence(jewish_date) occurrence = Zmanim::HebrewCalendar::JewishDate.new(jewish_date.jewish_year, jewish_date.jewish_month, day) decrement_month(occurrence) if occurrence >= jewish_date occurrence end |