Sha256: 5df7a5c0518c9313a39003c556d08f32ddaeb5a81e91d9c8174e171d9270f31a
Contents?: true
Size: 913 Bytes
Versions: 5
Compression:
Stored size: 913 Bytes
Contents
# frozen_string_literal: true require 'time_of_day' class Time def time_of_day TimeOfDay.new(hour, min, sec) end end class ActiveSupport::TimeWithZone def time_of_day TimeOfDay.new(hour, min, sec) end end class Date def at(time_of_day) time_of_day = TimeOfDay.parse(time_of_day) if time_of_day.is_a?(String) zone = Time.zone || Time zone.local(year, month, day, time_of_day.hour, time_of_day.minute, time_of_day.second) end end module Kernel # rubocop: disable Naming/MethodName def TimeOfDay(string_or_int, *ints) if string_or_int.is_a? String unless ints.empty? raise(ArgumentError, 'TimeOfDay() takes a string or multiple integers as arguments') end TimeOfDay.parse(string_or_int) else TimeOfDay.new(string_or_int, *ints) end end # rubocop: enable Naming/MethodName end YAML.add_tag 'tag:yaml.org,2002:time', TimeOfDay
Version data entries
5 entries across 5 versions & 1 rubygems