Module: Pgvector

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

Defined Under Namespace

Modules: PG

Constant Summary collapse

VERSION =
"0.2.1"

Class Method Summary collapse

Class Method Details

.decode(string) ⇒ Object



11
12
13
# File 'lib/pgvector.rb', line 11

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

.encode(data) ⇒ Object



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

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