Sha256: a1357ce5b4b5a8757db62f75d37c7b2c85fb1651d04157b2e0e5ea70ae2dd51f
Contents?: true
Size: 711 Bytes
Versions: 126
Compression:
Stored size: 711 Bytes
Contents
# frozen_string_literal: true class ReeDate::EndOfWeek include Ree::FnDSL fn :end_of_week do link :today link :days_since link :days_to_week_start end doc(<<~DOC) Returns a new date at the end of the week. If no date passed returns date at the end of the current week. date(optional) => Wed, 25 May 2022 end_of_week(date, :monday) # => Sun, 29 May 2022 end_of_week(date, :sunday) # => Sat, 28 May 2022 Week is assumed to end on +week_start+ (monday or sunday). DOC contract(Nilor[Date], Or[:sunday, :monday] => Date) def call(date = nil, week_start) date = date || today days_since(date, 6 - days_to_week_start(date, week_start)) end end
Version data entries
126 entries across 126 versions & 1 rubygems