Class: Openapi3Parser::NodeFactory::Array
- Inherits:
-
Object
- Object
- Openapi3Parser::NodeFactory::Array
- Defined in:
- lib/openapi3_parser/node_factory/array.rb
Defined Under Namespace
Classes: ValidNodeBuilder
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#default ⇒ Object
readonly
Returns the value of attribute default.
-
#use_default_on_empty ⇒ Object
readonly
Returns the value of attribute use_default_on_empty.
-
#validation ⇒ Object
readonly
Returns the value of attribute validation.
-
#value_factory ⇒ Object
readonly
Returns the value of attribute value_factory.
-
#value_input_type ⇒ Object
readonly
Returns the value of attribute value_input_type.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(context, default: [], use_default_on_empty: false, value_input_type: nil, value_factory: nil, validate: nil) ⇒ Array
constructor
rubocop:disable Metrics/ParameterLists.
- #inspect ⇒ Object
- #nil_input? ⇒ Boolean
- #node(node_context) ⇒ Object
-
#raw_input ⇒ Object
rubocop:enable Metrics/ParameterLists.
- #resolved_input ⇒ Object
- #use_default? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize(context, default: [], use_default_on_empty: false, value_input_type: nil, value_factory: nil, validate: nil) ⇒ Array
rubocop:disable Metrics/ParameterLists
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 10 def initialize( context, default: [], use_default_on_empty: false, value_input_type: nil, value_factory: nil, validate: nil ) @context = context @default = default @use_default_on_empty = use_default_on_empty @value_input_type = value_input_type @value_factory = value_factory @validation = validate @data = build_data(context.input) end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
6 7 8 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 6 def context @context end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 6 def data @data end |
#default ⇒ Object (readonly)
Returns the value of attribute default.
6 7 8 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 6 def default @default end |
#use_default_on_empty ⇒ Object (readonly)
Returns the value of attribute use_default_on_empty.
6 7 8 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 6 def use_default_on_empty @use_default_on_empty end |
#validation ⇒ Object (readonly)
Returns the value of attribute validation.
6 7 8 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 6 def validation @validation end |
#value_factory ⇒ Object (readonly)
Returns the value of attribute value_factory.
6 7 8 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 6 def value_factory @value_factory end |
#value_input_type ⇒ Object (readonly)
Returns the value of attribute value_input_type.
6 7 8 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 6 def value_input_type @value_input_type end |
Instance Method Details
#errors ⇒ Object
44 45 46 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 44 def errors @errors ||= ValidNodeBuilder.errors(self) end |
#inspect ⇒ Object
53 54 55 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 53 def inspect %{#{self.class.name}(#{context.source_location.inspect})} end |
#nil_input? ⇒ Boolean
36 37 38 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 36 def nil_input? context.input.nil? end |
#node(node_context) ⇒ Object
48 49 50 51 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 48 def node(node_context) data = ValidNodeBuilder.data(self, node_context) data.nil? ? nil : build_node(data, node_context) end |
#raw_input ⇒ Object
rubocop:enable Metrics/ParameterLists
28 29 30 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 28 def raw_input context.input end |
#resolved_input ⇒ Object
32 33 34 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 32 def resolved_input @resolved_input ||= build_resolved_input end |
#use_default? ⇒ Boolean
57 58 59 60 61 62 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 57 def use_default? return true if nil_input? || !raw_input.is_a?(::Array) return false unless use_default_on_empty raw_input.empty? end |
#valid? ⇒ Boolean
40 41 42 |
# File 'lib/openapi3_parser/node_factory/array.rb', line 40 def valid? errors.empty? end |