Class: ActiveRecord::Refined::AST::Function
- Includes:
- Predications
- Defined in:
- lib/active_record/refined/ast.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, args) ⇒ Function
constructor
A new instance of Function.
- #to_arel(table) ⇒ Object
Methods included from Predications
#!=, #!~, #<, #<=, #==, #=~, #>, #>=, #between?, #end_with?, #in?, #include?, #like?, #null?, #start_with?
Methods inherited from Node
Constructor Details
#initialize(name, args) ⇒ Function
Returns a new instance of Function.
178 179 180 181 |
# File 'lib/active_record/refined/ast.rb', line 178 def initialize(name, args) @name = name @args = args end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
176 177 178 |
# File 'lib/active_record/refined/ast.rb', line 176 def args @args end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
176 177 178 |
# File 'lib/active_record/refined/ast.rb', line 176 def name @name end |
Instance Method Details
#to_arel(table) ⇒ Object
183 184 185 186 187 188 189 190 191 |
# File 'lib/active_record/refined/ast.rb', line 183 def to_arel(table) arel_args = args.map do |arg| case arg when Node, Symbol then to_arel_operand(arg, table) else Arel::Nodes.build_quoted(arg) end end Arel::Nodes::NamedFunction.new(name, arel_args) end |