Method: ActiveType::TypeCaster.get

Defined in:
lib/active_type/type_caster.rb

.get(type) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/active_type/type_caster.rb', line 4

def self.get(type)
  native_caster = if ActiveRecord::VERSION::STRING < '4.2'
    NativeCasters::DelegateToColumn.new(type)
  elsif ActiveRecord::VERSION::STRING < '5'
    NativeCasters::DelegateToRails4Type.new(type)
  else
    NativeCasters::DelegateToRails5Type.new(type)
  end
  new(type, native_caster)
end