Class: ParamsProcessor::ParamDoc
- Inherits:
-
HashWithIndifferentAccess
- Object
- HashWithIndifferentAccess
- ParamsProcessor::ParamDoc
- Defined in:
- lib/params_processor/param_doc.rb
Instance Method Summary collapse
- #combined ⇒ Object
- #combined? ⇒ Boolean
- #combined_modes ⇒ Object
- #doced_permit? ⇒ Boolean
-
#range ⇒ Object
Interfaces for directly taking the processed info what we focus on.
- #real_name ⇒ Object
- #size ⇒ Object
Instance Method Details
#combined ⇒ Object
28 29 30 |
# File 'lib/params_processor/param_doc.rb', line 28 def combined { all_of: all_of, one_of: one_of, any_of: any_of, not: not_be }.keep_if { |_k, v| !v.nil? } end |
#combined? ⇒ Boolean
32 |
# File 'lib/params_processor/param_doc.rb', line 32 def combined?; combined.present? end |
#combined_modes ⇒ Object
34 |
# File 'lib/params_processor/param_doc.rb', line 34 def combined_modes; combined.keys end |
#doced_permit? ⇒ Boolean
38 |
# File 'lib/params_processor/param_doc.rb', line 38 def doced_permit?; permit? || not_permit? end |
#range ⇒ Object
Interfaces for directly taking the processed info what we focus on.
8 9 10 11 12 13 14 15 16 |
# File 'lib/params_processor/param_doc.rb', line 8 def range return if (schema.keys & %w[ minimum maximum ]).blank? { min: schema[:minimum] || -Float::INFINITY, max: schema[:maximum] || Float::INFINITY, should_neq_min?: schema[:exclusiveMinimum] || false, should_neq_max?: schema[:exclusiveMaximum] || false } end |
#real_name ⇒ Object
36 |
# File 'lib/params_processor/param_doc.rb', line 36 def real_name; as || name end |
#size ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/params_processor/param_doc.rb', line 18 def size return if (schema.keys & %w[ minItems maxItems minLength maxLength ]).blank? size = if type.in? %w[ array object ] [schema[:minItems], schema[:maxItems]] else [schema[:minLength], schema[:maxLength]] end { min: size[0] || 0, max: size[1] || Float::INFINITY } end |