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, #type

Instance Method Summary collapse

Methods inherited from Column

#human_name, #initialize, #klass, #type_cast

Constructor Details

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

Instance Method Details

#binary_to_string(value) ⇒ Object



73
74
75
76
77
78
79
80
# File 'lib/active_record/connection_adapters/sqlite_adapter.rb', line 73

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

#string_to_binary(value) ⇒ Object



64
65
66
67
68
69
70
71
# File 'lib/active_record/connection_adapters/sqlite_adapter.rb', line 64

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