Sha256: 345116e5f82d5e06cde6aea2530164789529c9f6473bf3d92011b2a203f8bfe7

Contents?: true

Size: 598 Bytes

Versions: 2

Compression:

Stored size: 598 Bytes

Contents

# frozen_string_literal: true
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::Json::QueryMethods < Sequel::QueryMethods
      include Sequel::PgQueryMethods

      private

      def matches(key, value, locale)
        build_op(key).get_text(locale) =~ value.to_s
      end

      def has_locale(key, locale)
        build_op(key).get_text(locale) !~ nil
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mobility-0.5.1 lib/mobility/backends/sequel/json/query_methods.rb
mobility-0.5.0 lib/mobility/backends/sequel/json/query_methods.rb