Sha256: 24073b74008a44686b201e5cf4d329878698c1f32420898e2ecc9f3a671750e5

Contents?: true

Size: 398 Bytes

Versions: 4

Compression:

Stored size: 398 Bytes

Contents

module Rasti
  module Types
    module Castable

      def cast(value)
        if valid? value
          transform! value
        else
          raise CastError.new self, value
        end
      end

      private

      def transform!(value)
        transform value
      rescue CompoundError => ex
        raise ex
      rescue
        raise CastError.new self, value
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rasti-types-1.1.2 lib/rasti/types/castable.rb
rasti-types-1.1.1 lib/rasti/types/castable.rb
rasti-types-1.1.0 lib/rasti/types/castable.rb
rasti-types-1.0.0 lib/rasti/types/castable.rb