module Yt::Associations::HasAttribute

@private

Public Class Methods

included(base) click to toggle source
# File lib/yt/associations/has_attribute.rb, line 8
def self.included(base)
  base.extend(ClassMethods)
end

Private Instance Methods

type_cast(value, type) click to toggle source
# File lib/yt/associations/has_attribute.rb, line 14
def type_cast(value, type)
  case [type]
    when [Time] then Yt::Timestamp.parse(value) if value
    when [Integer] then value.to_i if value
    when [Float] then value.to_f if value
    when [Symbol] then value.to_sym if value
    when [Hash] then value || {}
  end
end