Sha256: 86967cfd149279aa28c73002296cfbbd9cdcce45b1398ad0b3139c41de8669af

Contents?: true

Size: 557 Bytes

Versions: 2

Compression:

Stored size: 557 Bytes

Contents

require 'mobility/backends/sequel/pg_query_methods'
require "mobility/backends/sequel/query_methods"

Sequel.extension :pg_json, :pg_json_ops

module Mobility
  module Backends
    class Sequel::Jsonb::QueryMethods < Sequel::QueryMethods
      include Sequel::PgQueryMethods

      private

      def matches(key, value, locale)
        build_op(key)[locale] =~ value.to_json
      end

      def has_locale(key, locale)
        build_op(key).has_key?(locale)
      end

      def build_op(key)
        ::Sequel.pg_jsonb_op(key)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mobility-0.4.3 lib/mobility/backends/sequel/jsonb/query_methods.rb
mobility-0.4.2 lib/mobility/backends/sequel/jsonb/query_methods.rb