Class: Readymade::Form::FormOptions
- Inherits:
-
Object
- Object
- Readymade::Form::FormOptions
- Defined in:
- lib/readymade/form.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #as_json(options = {}) ⇒ Object
-
#initialize(**args) ⇒ FormOptions
constructor
A new instance of FormOptions.
- #required?(attr) ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(**args) ⇒ FormOptions
Returns a new instance of FormOptions.
186 187 188 189 |
# File 'lib/readymade/form.rb', line 186 def initialize(**args) @args = args @f_class = args.delete(:form_class) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
184 185 186 |
# File 'lib/readymade/form.rb', line 184 def args @args end |
Instance Method Details
#[](key) ⇒ Object
191 192 193 |
# File 'lib/readymade/form.rb', line 191 def [](key) to_h[key] end |
#as_json(options = {}) ⇒ Object
201 202 203 |
# File 'lib/readymade/form.rb', line 201 def as_json( = {}) to_h.as_json() end |
#required?(attr) ⇒ Boolean
205 206 207 |
# File 'lib/readymade/form.rb', line 205 def required?(attr) @f_class::REQUIRED_ATTRIBUTES.include?(attr.to_sym) end |