Sha256: 353f5aa6a9b3dba0279450effe96f0daea201174018ac976ddb61f8a6548b6b6

Contents?: true

Size: 683 Bytes

Versions: 3

Compression:

Stored size: 683 Bytes

Contents

require 'arel/attributes/attribute'

module Arel
  module Attributes
    ###
    # Factory method to wrap a raw database +column+ to an Arel Attribute.
    def self.for column
      case column.type
      when :string, :text, :binary             then String
      when :integer                            then Integer
      when :float                              then Float
      when :decimal                            then Decimal
      when :date, :datetime, :timestamp, :time then Time
      when :boolean                            then Boolean
      else
        raise NotImplementedError, "Column type `#{column.type}` is not currently handled"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
arel-2.0.2 lib/arel/attributes.rb
arel-2.0.1 lib/arel/attributes.rb
arel-2.0.0 lib/arel/attributes.rb