Class: ActiveRecord::Refined::AST::Function
- 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 inherited from Node
Constructor Details
#initialize(name, args) ⇒ Function
Returns a new instance of Function.
121 122 123 124 |
# File 'lib/active_record/refined/ast.rb', line 121 def initialize(name, args) @name = name @args = args end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
119 120 121 |
# File 'lib/active_record/refined/ast.rb', line 119 def args @args end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
119 120 121 |
# File 'lib/active_record/refined/ast.rb', line 119 def name @name end |
Instance Method Details
#to_arel(table) ⇒ Object
126 127 128 129 130 131 132 133 134 135 |
# File 'lib/active_record/refined/ast.rb', line 126 def to_arel(table) arel_args = args.map do |arg| case arg when Node then arg.to_arel(table) when Symbol then table[arg] else Arel::Nodes.build_quoted(arg) end end Arel::Nodes::NamedFunction.new(name, arel_args) end |