Sha256: 77dc4ec40025b5f995e3b85b1aaace3557b8aa0c08b98d76911a786938ff792a
Contents?: true
Size: 465 Bytes
Versions: 9
Compression:
Stored size: 465 Bytes
Contents
# frozen_string_literal: false module EnumConverter class << self def to_hash(value) return value if value.is_a?(Hash) hash_caster.cast(value) end def to_array(value) return value if value.is_a?(Array) array_caster.cast(value) end private def hash_caster @hash_caster ||= EnumCaster.caster_for(:hash) end def array_caster @array_caster ||= EnumCaster.caster_for(:array) end end end
Version data entries
9 entries across 9 versions & 1 rubygems