Class: Grape::Validations::SharedOptions
- Inherits:
-
Data
- Object
- Data
- Grape::Validations::SharedOptions
- Defined in:
- lib/grape/validations/shared_options.rb
Overview
Immutable value object holding the two options every validator reads at construction time: allow_blank and fail_fast. Internal to Validators::Base, which builds it from the opts Hash so the public 5th-argument contract stays a plain Hash — not part of any wire contract.
Defaults mirror the prior opts.values_at behaviour: allow_blank is nil when the declaration didn’t supply it (validators treat nil as “not set”), fail_fast defaults to false.
Instance Attribute Summary collapse
-
#allow_blank ⇒ Object
readonly
Returns the value of attribute allow_blank.
-
#fail_fast ⇒ Object
readonly
Returns the value of attribute fail_fast.
Instance Method Summary collapse
-
#initialize(allow_blank: nil, fail_fast: false) ⇒ SharedOptions
constructor
A new instance of SharedOptions.
Constructor Details
#initialize(allow_blank: nil, fail_fast: false) ⇒ SharedOptions
Returns a new instance of SharedOptions.
14 15 16 |
# File 'lib/grape/validations/shared_options.rb', line 14 def initialize(allow_blank: nil, fail_fast: false) super end |
Instance Attribute Details
#allow_blank ⇒ Object (readonly)
Returns the value of attribute allow_blank
13 14 15 |
# File 'lib/grape/validations/shared_options.rb', line 13 def allow_blank @allow_blank end |
#fail_fast ⇒ Object (readonly)
Returns the value of attribute fail_fast
13 14 15 |
# File 'lib/grape/validations/shared_options.rb', line 13 def fail_fast @fail_fast end |