Class: ActiveRecord::ConnectionAdapters::SQLite3WasmAdapter::JSBinary

Inherits:
ActiveModel::Type::Binary
  • Object
show all
Defined in:
lib/active_record/connection_adapters/sqlite3_wasm_adapter.rb

Overview

This type converts byte arrays represented as strings from JS to binaries in Ruby

Instance Method Summary collapse

Instance Method Details

#deserialize(value) ⇒ Object



161
162
163
164
165
166
167
168
# File 'lib/active_record/connection_adapters/sqlite3_wasm_adapter.rb', line 161

def deserialize(value)
  bvalue = value
  if value.is_a?(String)
    bvalue = value.split(",").map(&:to_i).pack("c*")
  end

  super(bvalue)
end