Class: Squeel::Nodes::Function
- Inherits:
-
Object
- Object
- Squeel::Nodes::Function
- Includes:
- Operators, PredicateMethods
- Defined in:
- lib/squeel/nodes/function.rb
Overview
A node that represents an SQL function call
Direct Known Subclasses
Instance Attribute Summary collapse
- #alias ⇒ String, NilClass readonly
-
#args ⇒ Array
readonly
The arguments to be passed to the SQL function.
-
#name ⇒ Symbol
readonly
The name of the SQL function to be called.
Instance Method Summary collapse
-
#as(alias_name) ⇒ Function
Set an alias for the function.
- #asc ⇒ Object
- #desc ⇒ Object
-
#initialize(name, args) ⇒ Function
constructor
Create a node representing an SQL Function with the given name and arguments.
-
#to_sym ⇒ NilClass
expand_hash_conditions_for_aggregates assumes our hash keys can be converted to symbols, so this has to be implemented, but it doesn’t really have to do anything useful.
Methods included from Operators
Constructor Details
#initialize(name, args) ⇒ Function
Create a node representing an SQL Function with the given name and arguments
36 37 38 |
# File 'lib/squeel/nodes/function.rb', line 36 def initialize(name, args) @name, @args = name, args end |
Instance Attribute Details
#alias ⇒ String, NilClass (readonly)
31 32 33 |
# File 'lib/squeel/nodes/function.rb', line 31 def alias @alias end |
#args ⇒ Array (readonly)
Returns The arguments to be passed to the SQL function.
27 28 29 |
# File 'lib/squeel/nodes/function.rb', line 27 def args @args end |
#name ⇒ Symbol (readonly)
Returns The name of the SQL function to be called.
24 25 26 |
# File 'lib/squeel/nodes/function.rb', line 24 def name @name end |
Instance Method Details
#as(alias_name) ⇒ Function
Set an alias for the function
43 44 45 46 |
# File 'lib/squeel/nodes/function.rb', line 43 def as(alias_name) @alias = alias_name.to_s self end |
#desc ⇒ Object
52 53 54 |
# File 'lib/squeel/nodes/function.rb', line 52 def desc Order.new self, -1 end |
#to_sym ⇒ NilClass
expand_hash_conditions_for_aggregates assumes our hash keys can be converted to symbols, so this has to be implemented, but it doesn’t really have to do anything useful.
60 61 62 |
# File 'lib/squeel/nodes/function.rb', line 60 def to_sym nil end |