Sha256: 34807deb1b55e06e5aeaae75c9286b278363846ffe6cf15e215a15e69e4612ad
Contents?: true
Size: 566 Bytes
Versions: 6
Compression:
Stored size: 566 Bytes
Contents
# frozen_string_literal: true using SmartCore::Ext::BasicObjectAsObject # @api public # @since 0.1.0 # @version 0.3.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
6 entries across 6 versions & 1 rubygems