module Traits::Attribute::Type

Public Instance Methods

active_record_timestamp?() click to toggle source
# File lib/traits/attribute/type.rb, line 51
def active_record_timestamp?
  datetime? && (name == :created_at || name == :updated_at || name == :deleted_at)
end
big?() click to toggle source
# File lib/traits/attribute/type.rb, line 23
def big?
  text? || binary?
end
binary?() click to toggle source
# File lib/traits/attribute/type.rb, line 19
def binary?
  type == :binary
end
datetime?() click to toggle source
# File lib/traits/attribute/type.rb, line 47
def datetime?
  type == :datetime
end
decimal?() click to toggle source
# File lib/traits/attribute/type.rb, line 35
def decimal?
  type == :decimal
end
float?() click to toggle source
# File lib/traits/attribute/type.rb, line 31
def float?
  type == :float
end
integer?() click to toggle source
# File lib/traits/attribute/type.rb, line 27
def integer?
  type == :integer
end
number?() click to toggle source
# File lib/traits/attribute/type.rb, line 43
def number?
  integer? || float? || decimal?
end
real?() click to toggle source
# File lib/traits/attribute/type.rb, line 39
def real?
  float? || decimal?
end
string?() click to toggle source
# File lib/traits/attribute/type.rb, line 11
def string?
  type == :string
end
text?() click to toggle source
# File lib/traits/attribute/type.rb, line 15
def text?
  type == :text
end
to_hash() click to toggle source
Calls superclass method
# File lib/traits/attribute/type.rb, line 55
def to_hash
  super.merge!(
    type: type
  )
end
type() click to toggle source
# File lib/traits/attribute/type.rb, line 7
def type
  @type ||= column_definition.type.to_sym
end