Class: ActiveHll::Type

Inherits:
ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Bytea
  • Object
show all
Defined in:
lib/active_hll/type.rb

Instance Method Summary collapse

Instance Method Details

#deserialize(value) ⇒ Object



16
17
18
19
# File 'lib/active_hll/type.rb', line 16

def deserialize(value)
  value = super
  value.nil? ? value : Hll.new(value)
end

#serialize(value) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/active_hll/type.rb', line 7

def serialize(value)
  if value.is_a?(Hll)
    value = value.value
  elsif !value.nil?
    raise ArgumentError, "can't cast #{value.class.name} to hll"
  end
  super(value)
end

#typeObject



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

def type
  :hll
end