Class: ActiveRecord::ConnectionAdapters::SQLServer::CoreExt::Time

Inherits:
Time
  • Object
show all
Includes:
DataCompat
Defined in:
lib/active_record/connection_adapters/sqlserver/core_ext/date_time.rb

Overview

Create our own Time class so that we can format strings properly and still have a Time class for the jdbc driver to work with

Instance Attribute Summary

Attributes included from DataCompat

#_sql_type

Class Method Summary collapse

Methods included from DataCompat

#quoted, #to_s

Class Method Details

._at_with_sql_type(value, type) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/active_record/connection_adapters/sqlserver/core_ext/date_time.rb', line 41

def self._at_with_sql_type(value, type)
  new(
      value.year,
      value.month,
      value.day,
      value.hour,
      value.min,
      value.sec + (Rational(value.nsec, 1000) / 1000000),
      value.gmt_offset
  ).tap { |t| t._sql_type = type }
end