Sha256: 9bdbf999a4aac0cc02d6f3d269db4d5de0a31315ba273b0a378e989d476ab26c
Contents?: true
Size: 506 Bytes
Versions: 2
Compression:
Stored size: 506 Bytes
Contents
# frozen_string_literal: true # @api public # @since 0.1.0 SmartCore::Types::Value.define_type(:Proc) do |type| type.define_checker do |value| value.is_a?(::Proc) end type.define_caster do |value| begin value.to_proc.tap do |result| unless result.is_a?(::Proc) raise(SmartCore::Types::TypeCastingError, 'Non-castable to Proc') end end rescue ::NoMethodError raise(SmartCore::Types::TypeCastingError, 'Non-castable to Proc') 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/proc.rb |
smart_types-0.1.0 | lib/smart_core/types/value/proc.rb |