File: validates_each.rb

package info (click to toggle)
ruby-validatable 1.6.7-11
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 284 kB
  • sloc: ruby: 1,636; makefile: 10
file content (14 lines) | stat: -rw-r--r-- 341 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
module Validatable
  class ValidatesEach < ValidationBase #:nodoc:
    required_option :logic
  
    def valid?(instance)
      instance.instance_eval(&logic)
      true # return true so no error is added. should look in the future at doing this different.
    end
    
    def message(instance)
      super || "is invalid"
    end
  end
end