lib/et-orbi.rb in et-orbi-1.0.0 vs lib/et-orbi.rb in et-orbi-1.0.1
- old
+ new
@@ -5,11 +5,11 @@
require 'tzinfo'
module EtOrbi
- VERSION = '1.0.0'
+ VERSION = '1.0.1'
class EoTime
#
# class methods
@@ -237,10 +237,24 @@
(?:[A-Za-z][A-Za-z0-9+_-]+)
(?:\/(?:[A-Za-z][A-Za-z0-9+_-]+)){0,2}
}x)
end
+ #def in_zone(&block)
+ #
+ # current_timezone = ENV['TZ']
+ # ENV['TZ'] = @zone
+ #
+ # block.call
+ #
+ #ensure
+ #
+ # ENV['TZ'] = current_timezone
+ #end
+ #
+ # kept around as a (thread-unsafe) relic
+
def self.platform_info
etos = Proc.new { |k, v| "#{k}:#{v.inspect}" }
'(' +
@@ -249,49 +263,28 @@
'tnz' => Time.now.zone,
'tzid' => defined?(TZInfo::Data),
'rv' => RUBY_VERSION,
'rp' => RUBY_PLATFORM,
'eov' => EtOrbi::VERSION,
+ 'rorv' => (Rails::VERSION::STRING rescue nil),
+ 'astz' => Time.respond_to?(:zone) ? Time.zone.name : nil,
+ # Active Support Time.zone
}.collect(&etos).join(',') + ',' +
gather_tzs.collect(&etos).join(',') +
')'
end
- #def in_zone(&block)
#
- # current_timezone = ENV['TZ']
- # ENV['TZ'] = @zone
- #
- # block.call
- #
- #ensure
- #
- # ENV['TZ'] = current_timezone
- #end
- #
- # kept around as a (thread-unsafe) relic
-
- #
# instance methods
attr_reader :seconds
attr_reader :zone
def initialize(s, zone)
@seconds = s.to_f
@zone = self.class.get_tzone(zone || :local)
- #fail ArgumentError.new(
- # "cannot determine timezone from #{zone.inspect}" +
- # " (etz:#{ENV['TZ'].inspect},tnz:#{Time.now.zone.inspect}," +
- # "tzid:#{defined?(TZInfo::Data).inspect}," +
- # "rv:#{RUBY_VERSION.inspect},rp:#{RUBY_PLATFORM.inspect}," +
- # "stz:(#{self.class.gather_tzs.map { |k, v| "#{k}:#{v.inspect}"}.join(',')})) \n" +
- # "Try setting `ENV['TZ'] = 'Continent/City'` in your script " +
- # "(see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)" +
- # (defined?(TZInfo::Data) ? '' : " and adding 'tzinfo-data' to your gems")
- #) unless @zone
fail ArgumentError.new(
"cannot determine timezone from #{zone.inspect}" +
"\n#{self.class.platform_info}" +
"\nTry setting `ENV['TZ'] = 'Continent/City'` in your script " +
"(see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)" +