Sha256: 8a48a80bfeed83aa18c11ba19ec1cb015acb48a80bb525bd0b9a6064119121e5

Contents?: true

Size: 456 Bytes

Versions: 8

Compression:

Stored size: 456 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(self, 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

8 entries across 8 versions & 1 rubygems

Version Path
rasti-form-3.0.0 lib/rasti/form/validable.rb
rasti-form-2.2.0 lib/rasti/form/validable.rb
rasti-form-2.1.0 lib/rasti/form/validable.rb
rasti-form-2.0.0 lib/rasti/form/validable.rb
rasti-form-1.1.1 lib/rasti/form/validable.rb
rasti-form-1.1.0 lib/rasti/form/validable.rb
rasti-form-1.0.3 lib/rasti/form/validable.rb
rasti-form-1.0.2 lib/rasti/form/validable.rb