Module: Sequel::SQL::OperatorBuilders
- Included in:
- Sequel, VirtualRow
- Defined in:
- lib/sequel/sql.rb
Overview
These methods are designed as replacements for the core extension operator methods, so that Sequel is still easy to use if the core extensions are not enabled.
The following methods are defined via metaprogramming: , -, *, /, &, |. The , -, *, and / operators return numeric expressions combining all the arguments with the appropriate operator, and the & and | operators return boolean expressions combining all of the arguments with either AND or OR.
Instance Method Summary collapse
-
#**(a, b) ⇒ Object
Return NumericExpression for the exponentiation:.
-
#~(arg) ⇒ Object
Invert the given expression.
Instance Method Details
#**(a, b) ⇒ Object
Return NumericExpression for the exponentiation:
Sequel.**(2, 3) # SQL: power(2, 3)
902 903 904 |
# File 'lib/sequel/sql.rb', line 902 def **(a, b) SQL::NumericExpression.new(:**, a, b) end |
#~(arg) ⇒ Object
912 913 914 915 916 917 918 |
# File 'lib/sequel/sql.rb', line 912 def ~(arg) if condition_specifier?(arg) SQL::BooleanExpression.from_value_pairs(arg, :OR, true) else SQL::BooleanExpression.invert(arg) end end |