Sha256: 194a706283e707816d97281e566deb2003055bd296332fcffde49a3d985943b7

Contents?: true

Size: 414 Bytes

Versions: 7

Compression:

Stored size: 414 Bytes

Contents

module Rasti
  class Form
    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 MultiCastError, ValidationError => ex
        raise ex
      rescue
        raise CastError.new self, value
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rasti-form-3.1.2 lib/rasti/form/castable.rb
rasti-form-3.1.1 lib/rasti/form/castable.rb
rasti-form-3.1.0 lib/rasti/form/castable.rb
rasti-form-3.0.0 lib/rasti/form/castable.rb
rasti-form-2.2.0 lib/rasti/form/castable.rb
rasti-form-2.1.0 lib/rasti/form/castable.rb
rasti-form-2.0.0 lib/rasti/form/castable.rb