Class: ActiveRecord::ConnectionAdapters::BigqueryColumn

Inherits:
Column
  • Object
show all
Defined in:
lib/active_record/connection_adapters/bigquery_adapter.rb

Constant Summary collapse

TRUE_VALUES =
[true, 1, '1', 'true', 'TRUE'].to_set
FALSE_VALUES =
[false, 0, '0','false', 'FALSE'].to_set

Class Method Summary collapse

Class Method Details

.binary_to_string(value) ⇒ Object



362
363
364
365
366
367
# File 'lib/active_record/connection_adapters/bigquery_adapter.rb', line 362

def binary_to_string(value)
  if value.encoding != Encoding::ASCII_8BIT
    value = value.force_encoding(Encoding::ASCII_8BIT)
  end
  value
end

.string_to_time(string) ⇒ Object



369
370
371
372
373
# File 'lib/active_record/connection_adapters/bigquery_adapter.rb', line 369

def string_to_time(string)
  return string unless string.is_a?(String)
  return nil if string.empty?
  fast_string_to_time(string) || fallback_string_to_time(string) || Time.at(string.to_f).send(Base.default_timezone)
end