Sha256: 593fdac3451d8d9e84cfb223cd1df0d144b3bc791867b55e04d9357f5b10fc2b
Contents?: true
Size: 598 Bytes
Versions: 7
Compression:
Stored size: 598 Bytes
Contents
require 't/cli' require 'time' module T class << self # Convert time to local time by applying the `utc_offset` setting. def local_time(time) utc_offset ? (time.dup.utc + utc_offset) : time.localtime end # UTC offset in seconds to apply time instances before displaying. # If not set, time instances are displayed in default local time. attr_reader :utc_offset def utc_offset=(offset) @utc_offset = case offset when String Time.zone_offset(offset) when NilClass nil else offset.to_i end end end end
Version data entries
7 entries across 7 versions & 1 rubygems
Version | Path |
---|---|
t-2.8.0 | lib/t.rb |
t-2.7.0 | lib/t.rb |
t-2.6.0 | lib/t.rb |
t-2.5.0 | lib/t.rb |
t-2.4.0 | lib/t.rb |
t-2.3.0 | lib/t.rb |
t-2.2.1 | lib/t.rb |