Default proc used for all underlying HStore hashes, so that even if you grab the underlying hash, it will still convert non-string keys to strings during lookup.
Parse the given string into an HStore, assuming the str is in PostgreSQL hstore output format.
# File lib/sequel/extensions/pg_hstore.rb, line 189 def self.parse(str) new(Parser.new(str).parse) end
Override to force the key argument to a string.
# File lib/sequel/extensions/pg_hstore.rb, line 215 def fetch(key, *args, &block) super(key.to_s, *args, &block) end
Convert the input hash to string keys and values before merging, and return a new HStore instance with the merged hash.
# File lib/sequel/extensions/pg_hstore.rb, line 221 def merge(hash, &block) self.class.new(super(convert_hash(hash), &block)) end
Wrap the receiver in an HStoreOp so you can easily use the PostgreSQL hstore functions and operators with it.
# File lib/sequel/extensions/pg_hstore_ops.rb, line 241 def op HStoreOp.new(self) end
Append a literalize version of the hstore to the sql.
# File lib/sequel/extensions/pg_hstore.rb, line 229 def sql_literal_append(ds, sql) ds.literal_append(sql, unquoted_literal) sql << HSTORE_CAST end
Return a string containing the unquoted, unstring-escaped literal version of the hstore. Separated out for use by the bound argument code.
# File lib/sequel/extensions/pg_hstore.rb, line 237 def unquoted_literal str = '' comma = false commas = COMMA quote = QUOTE kv_sep = KV_SEP null = NULL each do |k, v| str << commas if comma str << quote << escape_value(k) << quote str << kv_sep if v.nil? str << null else str << quote << escape_value(v) << quote end comma = true end str end