Class: Sequel::Plugins::DeprecatedValidationClassMethods::ClassMethods::Generator

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel/model/deprecated_validations.rb

Overview

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

Instance Method Summary collapse

Constructor Details

#initialize(receiver, &block) ⇒ Generator

Initializes a new generator.



9
10
11
12
# File 'lib/sequel/model/deprecated_validations.rb', line 9

def initialize(receiver ,&block)
  @receiver = receiver
  instance_eval(&block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args, &block) ⇒ Object

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



15
16
17
# File 'lib/sequel/model/deprecated_validations.rb', line 15

def method_missing(m, *args, &block)
  @receiver.send(:"validates_#{m}", *args, &block)
end