Module: UseCases::ModuleOptins::Validated::DSL

Defined in:
lib/use_cases/module_optins/validated.rb

Instance Method Summary collapse

Instance Method Details

#block_with_config(&blk) ⇒ Object



61
62
63
64
65
66
# File 'lib/use_cases/module_optins/validated.rb', line 61

def block_with_config(&blk)
  proc do
    instance_exec(&UseCases.dry_validation)
    instance_exec(&blk)
  end
end

#json(*args, &blk) ⇒ Object



51
52
53
54
55
# File 'lib/use_cases/module_optins/validated.rb', line 51

def json(*args, &blk)
  _setup_validation

  _contract_class.json(*args, &block_with_config(&blk))
end

#option(*args, &blk) ⇒ Object



57
58
59
# File 'lib/use_cases/module_optins/validated.rb', line 57

def option(*args, &blk)
  _contract_class.option(*args, &block_with_config(&blk))
end

#params(*args, &blk) ⇒ Object



33
34
35
36
37
# File 'lib/use_cases/module_optins/validated.rb', line 33

def params(*args, &blk)
  _setup_validation

  _contract_class.params(*args, &block_with_config(&blk))
end

#rule(*args, &blk) ⇒ Object



45
46
47
48
49
# File 'lib/use_cases/module_optins/validated.rb', line 45

def rule(*args, &blk)
  _setup_validation

  _contract_class.rule(*args, &block_with_config(&blk))
end

#schema(*args, &blk) ⇒ Object



39
40
41
42
43
# File 'lib/use_cases/module_optins/validated.rb', line 39

def schema(*args, &blk)
  _setup_validation

  _contract_class.schema(*args, &block_with_config(&blk))
end