Class: Openapi3Parser::NodeFactory::Map

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

Direct Known Subclasses

Callback, Paths, Responses, SecurityRequirement

Defined Under Namespace

Classes: ValidNodeBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, allow_extensions: false, default: {}, value_input_type: nil, value_factory: nil, validate: nil) ⇒ Map

rubocop:disable Metrics/ParameterLists


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/openapi3_parser/node_factory/map.rb', line 11

def initialize(
  context,
  allow_extensions: false,
  default: {},
  value_input_type: nil,
  value_factory: nil,
  validate: nil
)
  @context = context
  @allow_extensions = allow_extensions
  @default = default
  @value_input_type = value_input_type
  @value_factory = value_factory
  @validation = validate
  @data = build_data(context.input)
end

Instance Attribute Details

#allow_extensionsObject (readonly)

Returns the value of attribute allow_extensions


6
7
8
# File 'lib/openapi3_parser/node_factory/map.rb', line 6

def allow_extensions
  @allow_extensions
end

#contextObject (readonly)

Returns the value of attribute context


6
7
8
# File 'lib/openapi3_parser/node_factory/map.rb', line 6

def context
  @context
end

#dataObject (readonly)

Returns the value of attribute data


6
7
8
# File 'lib/openapi3_parser/node_factory/map.rb', line 6

def data
  @data
end

#defaultObject (readonly)

Returns the value of attribute default


6
7
8
# File 'lib/openapi3_parser/node_factory/map.rb', line 6

def default
  @default
end

#validationObject (readonly)

Returns the value of attribute validation


6
7
8
# File 'lib/openapi3_parser/node_factory/map.rb', line 6

def validation
  @validation
end

#value_factoryObject (readonly)

Returns the value of attribute value_factory


6
7
8
# File 'lib/openapi3_parser/node_factory/map.rb', line 6

def value_factory
  @value_factory
end

#value_input_typeObject (readonly)

Returns the value of attribute value_input_type


6
7
8
# File 'lib/openapi3_parser/node_factory/map.rb', line 6

def value_input_type
  @value_input_type
end

Instance Method Details

#errorsObject


45
46
47
# File 'lib/openapi3_parser/node_factory/map.rb', line 45

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

#inspectObject


54
55
56
# File 'lib/openapi3_parser/node_factory/map.rb', line 54

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

#nil_input?Boolean

Returns:

  • (Boolean)

37
38
39
# File 'lib/openapi3_parser/node_factory/map.rb', line 37

def nil_input?
  context.input.nil?
end

#node(node_context) ⇒ Object


49
50
51
52
# File 'lib/openapi3_parser/node_factory/map.rb', line 49

def node(node_context)
  data = ValidNodeBuilder.data(self, node_context)
  data.nil? ? nil : build_node(data, node_context)
end

#raw_inputObject

rubocop:enable Metrics/ParameterLists


29
30
31
# File 'lib/openapi3_parser/node_factory/map.rb', line 29

def raw_input
  context.input
end

#resolved_inputObject


33
34
35
# File 'lib/openapi3_parser/node_factory/map.rb', line 33

def resolved_input
  @resolved_input ||= build_resolved_input
end

#valid?Boolean

Returns:

  • (Boolean)

41
42
43
# File 'lib/openapi3_parser/node_factory/map.rb', line 41

def valid?
  errors.empty?
end