Class: Openapi3Parser::NodeFactory::Array

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi3_parser/node_factory/array.rb

Defined Under Namespace

Classes: ValidNodeBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, default: [], value_input_type: nil, value_factory: nil, validate: nil) ⇒ Array

Returns a new instance of Array.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/openapi3_parser/node_factory/array.rb', line 15

def initialize(
  context,
  default: [],
  value_input_type: nil,
  value_factory: nil,
  validate: nil
)
  @context = context
  @default = default
  @value_input_type = value_input_type
  @value_factory = value_factory
  @validation = validate
  @data = build_data(context.input)
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



12
13
14
# File 'lib/openapi3_parser/node_factory/array.rb', line 12

def context
  @context
end

#dataObject (readonly)

Returns the value of attribute data.



12
13
14
# File 'lib/openapi3_parser/node_factory/array.rb', line 12

def data
  @data
end

#defaultObject (readonly)

Returns the value of attribute default.



12
13
14
# File 'lib/openapi3_parser/node_factory/array.rb', line 12

def default
  @default
end

#validationObject (readonly)

Returns the value of attribute validation.



12
13
14
# File 'lib/openapi3_parser/node_factory/array.rb', line 12

def validation
  @validation
end

#value_factoryObject (readonly)

Returns the value of attribute value_factory.



12
13
14
# File 'lib/openapi3_parser/node_factory/array.rb', line 12

def value_factory
  @value_factory
end

#value_input_typeObject (readonly)

Returns the value of attribute value_input_type.



12
13
14
# File 'lib/openapi3_parser/node_factory/array.rb', line 12

def value_input_type
  @value_input_type
end

Instance Method Details

#errorsObject



46
47
48
# File 'lib/openapi3_parser/node_factory/array.rb', line 46

def errors
  @errors ||= ValidNodeBuilder.errors(self)
end

#inspectObject



57
58
59
# File 'lib/openapi3_parser/node_factory/array.rb', line 57

def inspect
  %{#{self.class.name}(#{context.source_location.inspect})}
end

#nil_input?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/openapi3_parser/node_factory/array.rb', line 38

def nil_input?
  context.input.nil?
end

#nodeObject



50
51
52
53
54
55
# File 'lib/openapi3_parser/node_factory/array.rb', line 50

def node
  @node ||= begin
              data = ValidNodeBuilder.data(self)
              data.nil? ? nil : build_node(data)
            end
end

#raw_inputObject



30
31
32
# File 'lib/openapi3_parser/node_factory/array.rb', line 30

def raw_input
  context.input
end

#resolved_inputObject



34
35
36
# File 'lib/openapi3_parser/node_factory/array.rb', line 34

def resolved_input
  @resolved_input ||= build_resolved_input
end

#valid?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/openapi3_parser/node_factory/array.rb', line 42

def valid?
  errors.empty?
end