Sha256: 0cd02ed352a01d89d6aea6ccb6b45cb05fb369bdc987280eb769a2f731bc928b

Contents?: true

Size: 422 Bytes

Versions: 2

Compression:

Stored size: 422 Bytes

Contents

module Timely
  module Time
    def on_date(year, month = nil, day = nil)
      if year.is_a?(Date)
        date = year
        year, month, day = date.year, date.month, 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_method :on, :on_date
  end
end

class Time
  include Timely::Time
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
timely-0.1.0 lib/timely/time.rb
timely-0.0.2 lib/timely/time.rb