Class: Openapi3Parser::SourceInput::ResolveNext

Inherits:
Object
  • Object
show all
Defined in:
lib/openapi3_parser/source_input/resolve_next.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reference, current_source_input, base_url, working_directory) ⇒ ResolveNext

Returns a new instance of ResolveNext.



19
20
21
22
23
24
25
26
27
# File 'lib/openapi3_parser/source_input/resolve_next.rb', line 19

def initialize(reference,
               current_source_input,
               base_url,
               working_directory)
  @reference = reference
  @current_source_input = current_source_input
  @base_url = base_url
  @working_directory = working_directory
end

Class Method Details

.call(reference, current_source_input, base_url: nil, working_directory: nil) ⇒ SourceInput

Parameters:

  • reference (Source::Reference)
  • current_source_input (SourceInput)
  • base_url (String, nil) (defaults to: nil)
  • working_directory (String, nil) (defaults to: nil)

Returns:



11
12
13
14
15
16
17
# File 'lib/openapi3_parser/source_input/resolve_next.rb', line 11

def self.call(reference,
              current_source_input,
              base_url: nil,
              working_directory: nil)
  new(reference, current_source_input, base_url, working_directory)
    .source_input
end

Instance Method Details

#source_inputObject



31
32
33
34
35
36
37
38
39
# File 'lib/openapi3_parser/source_input/resolve_next.rb', line 31

def source_input
  return current_source_input if reference.only_fragment?

  if reference.absolute?
    SourceInput::Url.new(reference.resource_uri)
  else
    base_url ? url_source_input : file_source_input
  end
end