Sha256: ad1a39bcac2e8d87dc0138bc8adda866d9b993c280af7f5ece522d562627f608
Contents?: true
Size: 378 Bytes
Versions: 2
Compression:
Stored size: 378 Bytes
Contents
# frozen_string_literal: true # @api public # @since 0.1.0 SmartCore::Types::Value.define_type(:Symbol) do |type| type.define_checker do |value| value.is_a?(::Symbol) end type.define_caster do |value| begin value.to_sym rescue ::NoMethodError, ::ArgumentError raise(SmartCore::Types::TypeCastingError, 'Non-castable to Symbol') end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
smart_types-0.2.0 | lib/smart_core/types/value/symbol.rb |
smart_types-0.1.0 | lib/smart_core/types/value/symbol.rb |