Class: ArelExtensions::Nodes::Format

Inherits:
Function
  • Object
show all
Defined in:
lib/arel_extensions/nodes/format.rb

Constant Summary collapse

RETURN_TYPE =
:string

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Function

#!=, #==, #as, #convert_to_date_node, #convert_to_datetime_node, #convert_to_node, #convert_to_number, #convert_to_string_node, #expr, #left, #return_type, #right, #type_of_attribute

Methods included from Predications

#cast, #convert_to_node, #imatches, #in, #matches, #not_in, #when

Constructor Details

#initialize(expr) ⇒ Format

Returns a new instance of Format.



7
8
9
10
11
12
# File 'lib/arel_extensions/nodes/format.rb', line 7

def initialize expr
  col = expr.first
  @iso_format = expr[1]
  @col_type = type_of_attribute(col)
  super [col, convert_to_string_node(@iso_format)]
end

Instance Attribute Details

#col_typeObject

Returns the value of attribute col_type.



6
7
8
# File 'lib/arel_extensions/nodes/format.rb', line 6

def col_type
  @col_type
end

#iso_formatObject

Returns the value of attribute iso_format.



6
7
8
# File 'lib/arel_extensions/nodes/format.rb', line 6

def iso_format
  @iso_format
end