Sha256: a18ffe135dcad7ac9d1e45b635a94326090171778989fabf22a342db4ae1e419

Contents?: true

Size: 362 Bytes

Versions: 9

Compression:

Stored size: 362 Bytes

Contents

# frozen_string_literal: true

require 'date'

DateTime.class_eval do
  unless method_defined?(:in_utc)
    # @return [DateTime]
    def in_utc
      utc? ? self : in_time_zone('UTC').to_datetime
    end
  end
end

Time.class_eval do
  unless method_defined?(:in_utc)
    # @return [Time]
    def in_utc
      utc? ? self : in_time_zone('UTC')
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ruby-rails-extensions-1.1.1 lib/ruby-rails-extensions/extensions/in_utc.rb
ruby-rails-extensions-1.1.1.pre.rc.1 lib/ruby-rails-extensions/extensions/in_utc.rb
ruby-rails-extensions-0.2.0 lib/ruby-rails-extensions/extensions/in_utc.rb
ruby-rails-extensions-0.2.0.pre.rc.1 lib/ruby-rails-extensions/extensions/in_utc.rb
ruby-rails-extensions-1.1.0 lib/ruby-rails-extensions/extensions/in_utc.rb
ruby-rails-extensions-1.1.0.pre.rc.1 lib/ruby-rails-extensions/extensions/in_utc.rb
ruby-rails-extensions-0.1.0 lib/ruby-rails-extensions/extensions/in_utc.rb
ruby-rails-extensions-1.0.0 lib/ruby-rails-extensions/extensions/in_utc.rb
ruby-rails-extensions-1.0.0.pre.rc.1 lib/ruby-rails-extensions/extensions/in_utc.rb