Sha256: d98d6c2118e165ce4f1c06227ae43804e183c2b056f177a0e6415ea209b902ca

Contents?: true

Size: 478 Bytes

Versions: 16

Compression:

Stored size: 478 Bytes

Contents

module Swift
  class Errors < Array
    attr_accessor :relation

    def initialize relation
      @relation = relation
    end
  end # Errors

  class Scheme
    def self.validations &validations
      define_method :validate do
        errors = Errors.new(self)
        instance_exec errors, &validations
        errors
      end
    end

    def validate errors = Errors.new(self)
      errors
    end

    def valid?
      validate.empty?
    end
  end # Scheme
end # Swift

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
swift-0.14.0 lib/swift/validations.rb
swift-0.13.0 lib/swift/validations.rb
swift-0.12.0 lib/swift/validations.rb
swift-0.11.0 lib/swift/validations.rb
swift-0.10.0 lib/swift/validations.rb
swift-0.9.1 lib/swift/validations.rb
swift-0.9.0 lib/swift/validations.rb
swift-0.8.1 lib/swift/validations.rb
swift-0.8.0 lib/swift/validations.rb
swift-0.7.2 lib/swift/validations.rb
swift-0.7.1 lib/swift/validations.rb
swift-0.7.0 lib/swift/validations.rb
swift-0.6.1 lib/swift/validations.rb
swift-0.6.0 lib/swift/validations.rb
swift-0.5.1 lib/swift/validations.rb
swift-0.5.0 lib/swift/validations.rb