class Openapi3Parser::NodeFactory::OptionalReference

Attributes

factory[R]

Public Class Methods

new(factory) click to toggle source
# File lib/openapi3_parser/node_factory/optional_reference.rb, line 6
def initialize(factory)
  @factory = factory
end

Public Instance Methods

call(context) click to toggle source
# File lib/openapi3_parser/node_factory/optional_reference.rb, line 14
def call(context)
  reference = context.input.is_a?(Hash) && context.input["$ref"]

  if reference
    NodeFactory::Reference.new(context, self)
  else
    factory.new(context)
  end
end
object_type() click to toggle source
# File lib/openapi3_parser/node_factory/optional_reference.rb, line 10
def object_type
  "#{self.class}[#{factory.object_type}]}"
end