class Sequel::Plugins::ValidationClassMethods::ClassMethods::Generator

The Generator class is used to generate validation definitions using the validates {} idiom.

Public Class Methods

new(receiver ,&block) click to toggle source

Initializes a new generator.

# File lib/sequel/plugins/validation_class_methods.rb, line 44
def initialize(receiver ,&block)
  @receiver = receiver
  instance_eval(&block)
end

Public Instance Methods

method_missing(m, *args, &block) click to toggle source

Delegates method calls to the receiver by calling receiver.validates_xxx.

# File lib/sequel/plugins/validation_class_methods.rb, line 50
def method_missing(m, *args, &block)
  @receiver.send(:"validates_#{m}", *args, &block)
end
respond_to_missing?(meth, include_private) click to toggle source

This object responds to all validates_* methods the model responds to.

# File lib/sequel/plugins/validation_class_methods.rb, line 55
def respond_to_missing?(meth, include_private)
  @receiver.respond_to?(:"validates_#{meth}", include_private)
end