Sha256: a2bf3b44426c4f1948bfddf330e6eda8a750ca399c1a86e7461eab74b6f90e8a
Contents?: true
Size: 564 Bytes
Versions: 126
Compression:
Stored size: 564 Bytes
Contents
# frozen_string_literal: true class ReeDate::DaysInMonth include Ree::FnDSL fn :days_in_month do link :today link 'ree_date/functions/constants', -> { COMMON_YEAR_DAYS_IN_MONTH } end doc(<<~DOC) Returns the number of days in the given month. If no year is specified, it will use the current year. DOC contract(Integer, Nilor[Integer] => Integer) def call(month, year = nil) year = year || today.year if month == 2 && Date.gregorian_leap?(year) 29 else COMMON_YEAR_DAYS_IN_MONTH[month - 1] end end end
Version data entries
126 entries across 126 versions & 1 rubygems