Module: Pgvector

Defined in:
lib/pgvector.rb,
lib/pgvector/pg.rb

Defined Under Namespace

Modules: Pg

Class Method Summary collapse

Class Method Details

.decode(string) ⇒ Object



7
8
9
# File 'lib/pgvector.rb', line 7

def self.decode(string)
  string[1..-2].split(",").map(&:to_f)
end

.encode(data) ⇒ Object



3
4
5
# File 'lib/pgvector.rb', line 3

def self.encode(data)
  "[#{data.to_a.map(&:to_f).join(",")}]"
end