Module: Noir::Util::Weekly
- Included in:
- Command::Edit::WeeklyReport
- Defined in:
- lib/noir/util/weekly.rb
Constant Summary collapse
- TimeOfADay =
utilities for calculation weeks
(24 * 60 * 60)
Instance Method Summary collapse
- #begin_of_week_separeted(separator_day_of_week, week_diff) ⇒ Object
- #end_of_week_separeted(separator_day_of_week, week_diff) ⇒ Object
Instance Method Details
#begin_of_week_separeted(separator_day_of_week, week_diff) ⇒ Object
20 21 22 |
# File 'lib/noir/util/weekly.rb', line 20 def begin_of_week_separeted separator_day_of_week, week_diff end_of_week_separeted(separator_day_of_week, week_diff) - (6*TimeOfADay) end |
#end_of_week_separeted(separator_day_of_week, week_diff) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/noir/util/weekly.rb', line 6 def end_of_week_separeted separator_day_of_week, week_diff check_method_name = "#{separator_day_of_week}?" unless Time.instance_methods(false).include?(check_method_name.to_sym) raise "a day of week name is incorrect! : #{separator_day_of_week}" end week_end = Time.now + (week_diff * 7 * TimeOfADay) week_end += TimeOfADay while !week_end.send(check_method_name) week_end += TimeOfADay end week_end - TimeOfADay end |