class Perpetuity::Postgres::SQLValue

Attributes

value[R]

Public Class Methods

new(value) click to toggle source
# File lib/perpetuity/postgres/sql_value.rb, line 15
def initialize value
  @value = case value
           when String, Symbol
             TextValue.new(value)
           when Time
             TimestampValue.new(value)
           when Date
             DateValue.new(value)
           when Fixnum, Float
             NumericValue.new(value)
           when Hash, JSONHash
             JSONHash.new(value.to_hash, :inner)
           when Array, JSONArray
             JSONArray.new(value.to_a, :inner)
           when nil
             NullValue.new
           when true, false
             BooleanValue.new(value)
           end.to_s
end

Public Instance Methods

==(other) click to toggle source
# File lib/perpetuity/postgres/sql_value.rb, line 40
def == other
  if other.is_a? String
    value == other
  else
    value == other.value
  end
end
to_s() click to toggle source
# File lib/perpetuity/postgres/sql_value.rb, line 36
def to_s
  value
end