Method: Sequel::SQL::Builders#pg_json_wrap

Defined in:
lib/sequel/extensions/pg_json.rb

#pg_json_wrap(v) ⇒ Object

Wraps Ruby array, hash, string, integer, float, true, false, and nil values with the appropriate JSON wrapper. Raises an exception for other types.



541
542
543
544
545
546
547
548
# File 'lib/sequel/extensions/pg_json.rb', line 541

def pg_json_wrap(v)
  case v
  when *Postgres::JSON_WRAP_CLASSES
    Postgres::JSONDatabaseMethods.json_primitive_wrapper(v).new(v)
  else
    raise Error, "invalid value passed to Sequel.pg_json_wrap: #{v.inspect}"
  end
end