Class: ActiveRecord::Refined::AST::Function

Inherits:
Node
  • Object
show all
Includes:
Arithmetics, Predications, Windowing
Defined in:
lib/active_record/refined/ast.rb

Direct Known Subclasses

WindowFunction

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Windowing

#over

Methods included from Arithmetics

#&, #*, #+, #-, #/, #<<, #>>, #^, #|, #~

Methods included from Predications

#!=, #!~, #<, #<=, #==, #=~, #>, #>=, #between?, #bury, #casecmp?, #contains?, #dig, #dig_json, #distinct_from?, #end_with?, #false?, #ilike?, #in?, #include?, #intersect?, #key?, #like?, #member?, #not_between?, #not_distinct_from?, #not_false?, #not_ilike?, #not_in?, #not_like?, #not_null?, #not_true?, #null?, #start_with?, #subset?, #superset?, #true?, #when

Methods inherited from Node

#as, #asc, #desc

Constructor Details

#initialize(name, args) ⇒ Function

Returns a new instance of Function.



1034
1035
1036
1037
# File 'lib/active_record/refined/ast.rb', line 1034

def initialize(name, args)
  @name = name
  @args = args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



1032
1033
1034
# File 'lib/active_record/refined/ast.rb', line 1032

def args
  @args
end

#nameObject (readonly)

Returns the value of attribute name.



1032
1033
1034
# File 'lib/active_record/refined/ast.rb', line 1032

def name
  @name
end

Instance Method Details

#to_arel(table, model) ⇒ Object



1039
1040
1041
1042
# File 'lib/active_record/refined/ast.rb', line 1039

def to_arel(table, model)
  arel_args = args.map {|arg| to_arel_argument(arg, table, model) }
  Arel::Nodes::NamedFunction.new(name, arel_args)
end