Class: Sequel::Plugins::ValidationHelpersBlock::ValidationHelpersValidationsBlock
- Inherits:
- BasicObject
- Defined in:
- lib/sequel/plugins/validation_helpers_block.rb
Overview
DSL class used inside attribute blocks. The only methods allowed inside the block are those supported by validation_helpers, and they specify the validations to run for the related attribute on the related object.
Constant Summary collapse
- VALIDATION_HELPERS_NO_ARG_METHODS =
validation_helpers methods that do not require a leading argument.
[:integer, :schema_types, :numeric, :presence, :unique].freeze
- VALIDATION_HELPERS_1_ARG_METHODS =
validation_helpers methods that require a leading argument
[:exact_length, :format, :includes, :length_range, :max_length, :min_length, :type].freeze
Instance Method Summary collapse
-
#initialize(obj, attr, &block) ⇒ ValidationHelpersValidationsBlock
constructor
Store the object and attribute and instance_eval the block.
Constructor Details
#initialize(obj, attr, &block) ⇒ ValidationHelpersValidationsBlock
Store the object and attribute and instance_eval the block.
64 65 66 67 68 |
# File 'lib/sequel/plugins/validation_helpers_block.rb', line 64 def initialize(obj, attr, &block) @obj = obj @attr = attr instance_eval(&block) end |