Permalink
Browse files

Merge branch 'master' of github.com:mbj/aequitas

  • Loading branch information...
2 parents 4a4269e + 5eeaf35 commit dba1dee44978a89f622a82db3a70ac0f5307e143 Markus Schirp committed Jan 21, 2013
Showing with 9 additions and 7 deletions.
  1. +8 −6 README.md
  2. +1 −1 lib/aequitas/rule/nullary/attribute/length.rb
View
14 README.md
@@ -4,6 +4,8 @@ It originates from [emmanuels aequitas repository](https://github.com/emmanuel/a
with the following changes:
* Only support for external validators
+* Use composable algebra for internals
+* Will allow serialization to javascript for client side validation (not implemented)
* No contextual validators anymore (use additional external validators)
* Use dkubb/equalizer and dkubb/adamantium where possible.
@@ -29,15 +31,15 @@ end
ruby = ProgrammingLanguage.new('ruby')
-result = VALIDATOR.new(ruby)
+result = VALIDATOR.validate(ruby)
result.valid? # => true
-result.errors # => []
+result.violations # => #<Set: {}>
other = ProgrammingLanguage.new('')
-result = VALIDATOR.new(other)
+result = VALIDATOR.validate(other)
result.valid? # => false
-result.errors # => [<Aequitas::Rule::Violation ....>]
+result.violations # => #<Set: {<Aequitas:::Violation ....>}>
```
@@ -63,11 +65,11 @@ the #errors method.
For example:
```ruby
-result = YOUR_VALIDATOR.validte(Account.new(:name => "Jose"))
+result = YOUR_VALIDATOR.validate(Account.new(:name => "Jose"))
if result.valid?
# my_account is valid and can be saved
else
- result.errors.each do |e|
+ result.violations.each do |e|
puts e
end
end
View
2 lib/aequitas/rule/nullary/attribute/length.rb
@@ -43,7 +43,7 @@ def minmax
min, max = minimum, maximum
if min and max
- return Machter::Binary::AND.new(min, max)
+ return Matcher::Binary::AND.new(min, max)
end
end
memoize :minmax

0 comments on commit dba1dee

Please sign in to comment.