Method: Sequel::SQL::Builders#pg_jsonb_wrap

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

#pg_jsonb_wrap(v) ⇒ Object

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

[View source]

573
574
575
576
577
578
579
580
# File 'lib/sequel/extensions/pg_json.rb', line 573

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