Class: AlgebraDB::Value::Array::Decoder

Inherits:
Exec::Decoder show all
Defined in:
lib/algebra_db/value/array.rb

Overview

Decodes into ruby arrays.

Instance Method Summary collapse

Constructor Details

#initialize(inner_decoder) ⇒ Decoder

rubocop:disable Lint/MissingSuper



18
19
20
# File 'lib/algebra_db/value/array.rb', line 18

def initialize(inner_decoder) # rubocop:disable Lint/MissingSuper
  @inner_decoder = inner_decoder
end

Instance Method Details

#decode_value(db_value) ⇒ Object



28
29
30
# File 'lib/algebra_db/value/array.rb', line 28

def decode_value(db_value)
  db_value.map { |v| @inner_decoder.decode_value(v) }
end

#pg_decoderObject



22
23
24
25
26
# File 'lib/algebra_db/value/array.rb', line 22

def pg_decoder
  PG::TextDecoder::Array.new.tap do |decoder|
    decoder.elements_type = @inner_decoder.pg_decoder
  end
end