Sha256: 7ba022d1cf26d0a3bb461f2a8384f86ba00e7731b338b4e806d77d901115ab2e
Contents?: true
Size: 951 Bytes
Versions: 5
Compression:
Stored size: 951 Bytes
Contents
# encoding: utf-8 # frozen_string_literal: true module Traits class Attribute module Type def type @type ||= column_definition.type.to_sym end def string? type == :string end def text? type == :text end def binary? type == :binary end def big? text? || binary? end def integer? type == :integer end def float? type == :float end def decimal? type == :decimal end def real? float? || decimal? end def number? integer? || float? || decimal? end def datetime? type == :datetime end def active_record_timestamp? datetime? && (name == :created_at || name == :updated_at || name == :deleted_at) end def to_hash super.merge!( type: type ) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems