Sha256: 9b845f9e82a90dafbe3af48a6773d4a3cb981804311631b08e8c3d94b3e8d499

Contents?: true

Size: 450 Bytes

Versions: 1

Compression:

Stored size: 450 Bytes

Contents

module Rasti
  class Form
    module Validable

      private

      def errors
        @errors ||= Hash.new { |hash, key| hash[key] = [] }
      end

      def validate!
        validate
        raise ValidationError.new(errors) unless errors.empty?
      end

      def validate
      end

      def assert(key, condition, message)
        return true if condition
        
        errors[key] << message
        false
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rasti-form-1.0.1 lib/rasti/form/validable.rb