Module: FancyHash::Types
- Defined in:
- lib/fancy_hash.rb
Defined Under Namespace
Classes: Array, BinBoolean, Date, DateTime, Enum, Money
Class Method Summary collapse
Class Method Details
.find(type, **config) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/fancy_hash.rb', line 56 def find(type, **config) return type if type.is_a?(Class) { nil => -> { ActiveModel::Type::Value.new }, array: -> { Types::Array.new(**config) }, boolean: -> { ActiveModel::Type::Boolean.new }, binboolean: -> { BinBoolean.new }, string: -> { ActiveModel::Type::String.new }, date: -> { Date.new }, datetime: -> { DateTime.new }, integer: -> { ActiveModel::Type::Integer.new }, decimal: -> { ActiveModel::Type::Decimal.new }, money: -> { Money.new }, enum: -> { Enum.new(**config) }, }.fetch(type).call end |