Class: ArelExtensions::Nodes::Format

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

Constant Summary collapse

RETURN_TYPE =
:string

Constants inherited from Function

ArelExtensions::Nodes::Function::MBSTRING

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.



10
11
12
13
14
15
# File 'lib/arel_extensions/nodes/format.rb', line 10

def initialize expr
  col = expr.first
  @iso_format = convert_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.



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

def col_type
  @col_type
end

#iso_formatObject

Returns the value of attribute iso_format.



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

def iso_format
  @iso_format
end