Sha256: f11f207b25ba75992fa84bbec68f3f6dbd97bee4b28d7c58da6b13cd3d7e70d4

Contents?: true

Size: 588 Bytes

Versions: 3

Compression:

Stored size: 588 Bytes

Contents

require 'rom/sql/dsl'

module ROM
  module SQL
    # @api private
    class RestrictionDSL < DSL
      # @api private
      def call(&block)
        instance_exec(select_relations(block.parameters), &block)
      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

3 entries across 3 versions & 1 rubygems

Version Path
rom-sql-3.1.0 lib/rom/sql/restriction_dsl.rb
rom-sql-3.0.1 lib/rom/sql/restriction_dsl.rb
rom-sql-3.0.0 lib/rom/sql/restriction_dsl.rb