Sha256: 671e094136847f5da5c0628712f8614818b26af4a957c2e33eba4ee038cc2238

Contents?: true

Size: 244 Bytes

Versions: 2

Compression:

Stored size: 244 Bytes

Contents

module Validatable
  class ValidatesTrueFor < ValidationBase #:nodoc:
    required_option :logic
  
    def valid?(instance)
      instance.instance_eval(&logic) == true
    end
    
    def message
      super || "is invalid"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
validatable-1.3.2 lib/validations/validates_true_for.rb
validatable-1.3.0 lib/validations/validates_true_for.rb