Sha256: ec78c7a551b807747a67a7e97d13b07fe5d890268bffda3332433ee527f72746
Contents?: true
Size: 616 Bytes
Versions: 4
Compression:
Stored size: 616 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) time = time.dup utc_offset ? (time.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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
t-3.1.0 | lib/t.rb |
t-3.0.0 | lib/t.rb |
t-2.10.0 | lib/t.rb |
t-2.9.0 | lib/t.rb |