Class: TeamsIncomingClients::Dates::Policies::DatePolicy
- Inherits:
-
Object
- Object
- TeamsIncomingClients::Dates::Policies::DatePolicy
- Defined in:
- lib/teams_incoming_clients/models/dates/policies/date_policy.rb
Instance Method Summary collapse
- #holiday_date? ⇒ Boolean
-
#initialize(target_date) ⇒ DatePolicy
constructor
A new instance of DatePolicy.
- #today_match_day?(day_num) ⇒ Boolean
- #week_of_day?(week_of_day) ⇒ Boolean
Constructor Details
#initialize(target_date) ⇒ DatePolicy
Returns a new instance of DatePolicy.
5 6 7 |
# File 'lib/teams_incoming_clients/models/dates/policies/date_policy.rb', line 5 def initialize(target_date) @target_date = target_date end |
Instance Method Details
#holiday_date? ⇒ Boolean
9 10 11 12 13 |
# File 'lib/teams_incoming_clients/models/dates/policies/date_policy.rb', line 9 def holiday_date? common_flag = (target_date.saturday? || target_date.sunday?) japan_holiday_flag = HolidayJapan.check(target_date) common_flag || japan_holiday_flag end |
#today_match_day?(day_num) ⇒ Boolean
20 21 22 |
# File 'lib/teams_incoming_clients/models/dates/policies/date_policy.rb', line 20 def today_match_day?(day_num) target_date.day == day_num.to_i end |
#week_of_day?(week_of_day) ⇒ Boolean
15 16 17 18 |
# File 'lib/teams_incoming_clients/models/dates/policies/date_policy.rb', line 15 def week_of_day?(week_of_day) week_of_day_string = week_of_day.to_s.downcase @target_date.send("#{week_of_day_string}?") end |