Sha256: 9532539e2524ea8ee987219f8d014c0809f084cff4860db3b8aff5916b23da15
Contents?: true
Size: 812 Bytes
Versions: 126
Compression:
Stored size: 812 Bytes
Contents
# frozen_string_literal: true class ReeDate::Advance include Ree::FnDSL fn :advance doc(<<~DOC) Provides precise Date calculations for years, months, quarters and days. The +options+ parameter takes a hash with any of these keys: <tt>:years</tt>, <tt>:months</tt>, <tt>:quarters </tt>, <tt>:weeks</tt>, <tt>:days</tt>. DOC contract( Date, Ksplat[ years?: Integer, quarters?: Integer, months?: Integer, weeks?: Integer, days?: Integer ] => Date ) def call(date, **opts) date = date >> opts[:years] * 12 if opts[:years] date = date >> opts[:quarters] * 3 if opts[:quarters] date = date >> opts[:months] if opts[:months] date = date + opts[:weeks] * 7 if opts[:weeks] date = date + opts[:days] if opts[:days] date end end
Version data entries
126 entries across 126 versions & 1 rubygems