Class: Dry::Validation::Macro

Inherits:
Function
  • Object
show all
Defined in:
lib/dry/validation/macro.rb

Overview

A wrapper for macro validation blocks

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argsArray (readonly)

Returns:

  • (Array)


19
# File 'lib/dry/validation/macro.rb', line 19

option :args

#blockProc (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Proc)


24
# File 'lib/dry/validation/macro.rb', line 24

option :block

#nameSymbol (readonly)

Returns:

  • (Symbol)


14
# File 'lib/dry/validation/macro.rb', line 14

param :name

Instance Method Details

#extract_block_options(options) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



32
33
34
# File 'lib/dry/validation/macro.rb', line 32

def extract_block_options(options)
  block_options.transform_values { options[_1] }
end

#with(args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



27
28
29
# File 'lib/dry/validation/macro.rb', line 27

def with(args)
  self.class.new(name, args: args, block: block)
end