Module: Arel::Sql::Attributes

Defined in:
lib/arel/engines/sql/attributes.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.for(column) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/arel/engines/sql/attributes.rb', line 4

def self.for(column)
  case column.type
  when :string    then String
  when :text      then String
  when :integer   then Integer
  when :float     then Float
  when :decimal   then Decimal
  when :date      then Time
  when :datetime  then Time
  when :timestamp then Time
  when :time      then Time
  when :binary    then String
  when :boolean   then Boolean
  else
    raise NotImplementedError, "Column type `#{column.type}` is not currently handled"
  end
end

Instance Method Details

#initialize(column, *args) ⇒ Object



22
23
24
25
# File 'lib/arel/engines/sql/attributes.rb', line 22

def initialize(column, *args)
  @column = column
  super(*args)
end

#type_cast(value) ⇒ Object



27
28
29
# File 'lib/arel/engines/sql/attributes.rb', line 27

def type_cast(value)
  @column.type_cast(value)
end