Sha256: ee23f707061eeaf02331f0e75dde76c63ee1109ea719a697a77b2b783eae4150

Contents?: true

Size: 419 Bytes

Versions: 9

Compression:

Stored size: 419 Bytes

Contents

# frozen_string_literal: true

module Timely
  module Time
    def on_date(year, month = nil, day = nil)
      if year.is_a?(Date)
        date = year
        year = date.year
        month = date.month
        day = date.day
      end

      raise ArgumentError, 'Year, month, and day needed' unless [year, month, day].all?

      ::Time.local(year, month, day, hour, min, sec)
    end

    alias on on_date
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
timely-0.14.0 lib/timely/time.rb
timely-0.13.0 lib/timely/time.rb
timely-0.12.0 lib/timely/time.rb
timely-0.11.0 lib/timely/time.rb
timely-0.10.0 lib/timely/time.rb
timely-0.9.0 lib/timely/time.rb
timely-0.8.0 lib/timely/time.rb
timely-0.7.0 lib/timely/time.rb
timely-0.6.0 lib/timely/time.rb