Class: ROM::SQL::DSL Private

Inherits:
BasicObject
Defined in:
lib/rom/sql/dsl.rb

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.

Direct Known Subclasses

GroupDSL, OrderDSL, ProjectionDSL, RestrictionDSL

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(schema) ⇒ DSL

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.

Returns a new instance of DSL.



17
18
19
20
# File 'lib/rom/sql/dsl.rb', line 17

def initialize(schema)
  @schema = schema
  @relations = schema.respond_to?(:relations) ? schema.relations : EMPTY_HASH
end

Instance Attribute Details

#relationsObject (readonly)

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.



14
15
16
# File 'lib/rom/sql/dsl.rb', line 14

def relations
  @relations
end

#schemaObject (readonly)

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.



10
11
12
# File 'lib/rom/sql/dsl.rb', line 10

def schema
  @schema
end

Instance Method Details

#`(value) ⇒ Sequel::LiteralString

Return a string literal that will be used directly in an ORDER clause

Parameters:

  • value (String)

Returns:

  • (Sequel::LiteralString)


40
41
42
# File 'lib/rom/sql/dsl.rb', line 40

def `(value)
  ::Sequel.lit(value)
end

#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.



23
24
25
26
27
28
29
30
31
# File 'lib/rom/sql/dsl.rb', line 23

def call(&block)
  result = instance_exec(relations, &block)

  if result.is_a?(::Array)
    result
  else
    [result]
  end
end

#respond_to_missing?(name, include_private = false) ⇒ Boolean

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.

Returns:

  • (Boolean)


45
46
47
# File 'lib/rom/sql/dsl.rb', line 45

def respond_to_missing?(name, include_private = false)
  super || schema.key?(name)
end