Sha256: cae9772eed66cc511fea97ad7e8018c9cf527e784d5415c3c7914bfcaadb7921

Contents?: true

Size: 466 Bytes

Versions: 1

Compression:

Stored size: 466 Bytes

Contents

# frozen_string_literal: true

module Openapi3Parser
  module NodeFactory
    class OptionalReference
      def initialize(factory)
        @factory = factory
      end

      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

      private

      attr_reader :factory
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
openapi3_parser-0.5.2 lib/openapi3_parser/node_factory/optional_reference.rb