Module: Pathway::Plugins::DryValidation::V0_11::ClassMethods
- Defined in:
- lib/pathway/plugins/dry_validation/v0_11.rb
Instance Attribute Summary collapse
-
#auto_wire_options ⇒ Object
Returns the value of attribute auto_wire_options.
-
#form_class ⇒ Object
Returns the value of attribute form_class.
-
#form_options ⇒ Object
readonly
Returns the value of attribute form_options.
Instance Method Summary collapse
- #build_form(opts = {}) ⇒ Object
- #form(base = nil, **opts, &block) ⇒ Object
- #inherited(subclass) ⇒ Object
Instance Attribute Details
#auto_wire_options ⇒ Object
Returns the value of attribute auto_wire_options.
9 10 11 |
# File 'lib/pathway/plugins/dry_validation/v0_11.rb', line 9 def @auto_wire_options end |
#form_class ⇒ Object
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_options ⇒ Object (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 end |
Instance Method Details
#build_form(opts = {}) ⇒ Object
28 29 30 |
# File 'lib/pathway/plugins/dry_validation/v0_11.rb', line 28 def build_form(opts = {}) @builded_form || form_class.new(opts) end |
#form(base = nil, **opts, &block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pathway/plugins/dry_validation/v0_11.rb', line 11 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
32 33 34 35 36 |
# File 'lib/pathway/plugins/dry_validation/v0_11.rb', line 32 def inherited(subclass) super subclass.form_class = form_class subclass. = end |