Class: ROM::SQL::ProjectionDSL
Overview
Projection DSL used in reading API (‘select`, `select_append` etc.)
Instance Attribute Summary
Attributes inherited from DSL
Instance Method Summary collapse
-
#`(value) ⇒ Attribute
Return a string literal that will be directly used in an SQL statement or query.
- #respond_to_missing?(name, include_private = false) ⇒ Boolean private
Methods inherited from DSL
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, *args, &block) ⇒ 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.
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rom/sql/projection_dsl.rb', line 34 def method_missing(meth, *args, &block) if schema.key?(meth) schema[meth] else type = type(meth) if type ::ROM::SQL::Function.new(type) else super end end end |
Instance Method Details
#`(value) ⇒ Attribute
Return a string literal that will be directly used in an SQL statement or query
21 22 23 24 |
# File 'lib/rom/sql/projection_dsl.rb', line 21 def `(value) expr = ::Sequel.lit(value) ::ROM::SQL::Attribute.new(type(:string)).(sql_expr: expr) 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.
27 28 29 |
# File 'lib/rom/sql/projection_dsl.rb', line 27 def respond_to_missing?(name, include_private = false) super || type(name) end |