Sha256: a4fafc2350005fae137dcbbffaba53da942d13e2bd685e8eb7ac75e1e976eb02

Contents?: true

Size: 738 Bytes

Versions: 10

Compression:

Stored size: 738 Bytes

Contents

# frozen_string_literal: true

require 'rom/sql/dsl'

module ROM
  module SQL
    # @api private
    class RestrictionDSL < DSL
      # @api private
      def call(&block)
        arg, kwargs = select_relations(block.parameters)

        if kwargs.nil?
          instance_exec(arg, &block)
        else
          instance_exec(**kwargs, &block)
        end
      end

      private

      # @api private
      def method_missing(meth, *args, &block)
        if schema.key?(meth)
          schema[meth]
        else
          type = type(meth)

          if type
            ::ROM::SQL::Function.new(type)
          else
            ::Sequel::VIRTUAL_ROW.__send__(meth, *args, &block)
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rom-sql-3.6.2 lib/rom/sql/restriction_dsl.rb
rom-sql-3.6.1 lib/rom/sql/restriction_dsl.rb
rom-sql-3.6.0 lib/rom/sql/restriction_dsl.rb
rom-sql-3.5.0 lib/rom/sql/restriction_dsl.rb
rom-sql-3.4.0 lib/rom/sql/restriction_dsl.rb
rom-sql-3.3.3 lib/rom/sql/restriction_dsl.rb
rom-sql-3.3.2 lib/rom/sql/restriction_dsl.rb
rom-sql-3.3.1 lib/rom/sql/restriction_dsl.rb
rom-sql-3.3.0 lib/rom/sql/restriction_dsl.rb
rom-sql-3.2.0 lib/rom/sql/restriction_dsl.rb