Sha256: c4048f537e663dd9f21da6e4f4279865afd9b4206b2ec4378a135837309716c8
Contents?: true
Size: 754 Bytes
Versions: 1
Compression:
Stored size: 754 Bytes
Contents
require 'time' require 'active_support/string_inquirer' require 't/cli' module T class << self attr_reader :env def env=(environment) @env = ActiveSupport::StringInquirer.new(environment) end # Convert time to local time by applying the `utc_offset` setting. def local_time(time) 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
t-0.9.7 | lib/t.rb |