class ArelExtensions::Nodes::Coalesce
Constants
- RETURN_TYPE
Attributes
left_node_type[RW]
Public Class Methods
new(expr)
click to toggle source
Calls superclass method
# File lib/arel_extensions/nodes/coalesce.rb, line 12 def initialize expr tab = expr.map { |arg| convert_to_node(arg) } case expr.first when String @left_node_type = :string when Integer, Float @left_node_type = :number when ArelExtensions::Nodes::Coalesce, ArelExtensions::Nodes::Function @left_node_type = expr.first.respond_to?(:left_node_type) ? expr.first.left_node_type : nil when Arel::Nodes::Node, Arel::Attributes::Attribute @left_node_type = type_of_attribute(expr.first) when Date @left_node_type = :ruby_date when DateTime, Time @left_node_type = :ruby_time end return super(tab) end
Public Instance Methods
return_type()
click to toggle source
# File lib/arel_extensions/nodes/coalesce.rb, line 8 def return_type @left_node_type || self.class.const_get(:RETURN_TYPE) end