Class: ROM::SQL::RestrictionDSL Private

Inherits:
DSL
  • Object
show all
Defined in:
lib/rom/sql/restriction_dsl.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Direct Known Subclasses

JoinDSL

Instance Attribute Summary

Attributes inherited from DSL

#picked_relations, #relations, #schema

Instance Method Summary collapse

Methods inherited from DSL

#`, #exists, #initialize

Constructor Details

This class inherits a constructor from ROM::SQL::DSL

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth) ⇒ Object (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rom/sql/restriction_dsl.rb', line 27

def method_missing(meth, ...)
  if schema.key?(meth)
    schema[meth]
  else
    type = type(meth)

    if type
      ::ROM::SQL::Function.new(type).meta(schema: schema)
    else
      ::Sequel::VIRTUAL_ROW.__send__(meth, ...)
    end
  end
end

Instance Method Details

#call(&block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



10
11
12
13
14
15
16
17
18
# File 'lib/rom/sql/restriction_dsl.rb', line 10

def call(&block)
  arg, kwargs = select_relations(block.parameters)

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