Class: Sequel::Plugins::ValidationHelpersBlock::ValidationHelpersAttributesBlock

Inherits:
BasicObject
Defined in:
lib/sequel/plugins/validation_helpers_block.rb

Overview

DSL class used directly inside the validates block. Methods without an explicit receiver that are called inside the block are assumed to be attributes of the object that need to be validated.

Instance Method Summary collapse

Constructor Details

#initialize(obj, &block) ⇒ ValidationHelpersAttributesBlock

Set the object being validated and instance_eval the block.



40
41
42
43
# File 'lib/sequel/plugins/validation_helpers_block.rb', line 40

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, &block) ⇒ Object

Create a new ValidationHelpersValidationsBlock object using the stored object and given attribute name.



47
48
49
# File 'lib/sequel/plugins/validation_helpers_block.rb', line 47

def method_missing(m, &block)
  ValidationHelpersValidationsBlock.new(@obj, m, &block)
end