Module: Pathway::Plugins::DryValidation::V0_11::ClassMethods

Defined in:
lib/pathway/plugins/dry_validation/v0_11.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#auto_wireObject Also known as: auto_wire_options

Returns the value of attribute auto_wire.



9
10
11
# File 'lib/pathway/plugins/dry_validation/v0_11.rb', line 9

def auto_wire
  @auto_wire
end

#form_classObject

Returns the value of attribute form_class.



8
9
10
# File 'lib/pathway/plugins/dry_validation/v0_11.rb', line 8

def form_class
  @form_class
end

#form_optionsObject (readonly)

Returns the value of attribute form_options.



8
9
10
# File 'lib/pathway/plugins/dry_validation/v0_11.rb', line 8

def form_options
  @form_options
end

Instance Method Details

#build_form(opts = {}) ⇒ Object



31
32
33
# File 'lib/pathway/plugins/dry_validation/v0_11.rb', line 31

def build_form(opts = {})
  @builded_form || form_class.new(opts)
end

#form(base = nil, **opts, &block) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/pathway/plugins/dry_validation/v0_11.rb', line 14

def form(base = nil, **opts, &block)
  if block_given?
    base ||= _base_form
    self.form_class = _block_definition(base, opts, &block)
  elsif base
    self.form_class = _form_class(base)
  else
    raise ArgumentError, 'Either a form class or a block must be provided'
  end
end

#inherited(subclass) ⇒ Object



35
36
37
38
39
# File 'lib/pathway/plugins/dry_validation/v0_11.rb', line 35

def inherited(subclass)
  super
  subclass.form_class = form_class
  subclass.auto_wire  = auto_wire
end