Class: ActiveRecord::ConnectionAdapters::SQLiteColumn

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

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from Column

#default, #limit, #name, #null, #precision, #primary, #scale, #sql_type, #type

Class Method Summary collapse

Methods inherited from Column

#extract_default, #human_name, #initialize, #klass, #number?, string_to_date, string_to_dummy_time, string_to_time, #text?, #type_cast, #type_cast_code, value_to_boolean, value_to_decimal

Constructor Details

This class inherits a constructor from ActiveRecord::ConnectionAdapters::Column

Class Method Details

.binary_to_string(value) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/active_record/connection_adapters/sqlite_adapter.rb', line 57

def binary_to_string(value)
  value.gsub(/%00|%25/n) do |b|
    case b
      when "%00" then "\0"
      when "%25" then "%"
    end
  end
end

.string_to_binary(value) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/active_record/connection_adapters/sqlite_adapter.rb', line 48

def string_to_binary(value)
  value.gsub(/\0|\%/n) do |b|
    case b
      when "\0" then "%00"
      when "%"  then "%25"
    end
  end
end