Class: Validbot::Validator
- Inherits:
-
Object
- Object
- Validbot::Validator
- Defined in:
- lib/validbot.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(object, &block) ⇒ Validator
constructor
A new instance of Validator.
Constructor Details
#initialize(object, &block) ⇒ Validator
Returns a new instance of Validator.
15 16 17 18 19 20 21 22 |
# File 'lib/validbot.rb', line 15 def initialize(object, &block) klass(object).class_eval do include ::ActiveModel::Validations end klass(object).class_eval(&block) self end |
Class Method Details
.validate(object, &block) ⇒ Object
11 12 13 |
# File 'lib/validbot.rb', line 11 def self.validate(object, &block) self.new(object, &block) end |