Sha256: 61fe5c8c411fa6e3df2bfcd9fbf15a03938fbd1251c0bb8f64ea60a06babc635
Contents?: true
Size: 483 Bytes
Versions: 2
Compression:
Stored size: 483 Bytes
Contents
module SmsAero::Types # Describes coercible Unix time in future Future = Strict::Int.constructor do |value| begin error = TypeError.new "#{value.inspect} is not a valid time in future" time = value.to_time if value.respond_to? :to_time time ||= ::Time.parse(value.to_s) unless value.is_a? Numeric number = time.to_i number > ::Time.now.to_i ? number : raise(error) rescue StandardError raise error end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sms_aero-0.0.11 | lib/sms_aero/types/future.rb |
sms_aero-0.0.10 | lib/sms_aero/types/future.rb |