Class: OpenApiParser::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/open_api_parser/document.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, content, file_cache) ⇒ Document

Returns a new instance of Document.



10
11
12
13
14
# File 'lib/open_api_parser/document.rb', line 10

def initialize(path, content, file_cache)
  @path = path
  @content = content
  @file_cache = file_cache
end

Class Method Details

.resolve(path, file_cache = OpenApiParser::FileCache.new) ⇒ Object



3
4
5
6
7
8
# File 'lib/open_api_parser/document.rb', line 3

def self.resolve(path, file_cache = OpenApiParser::FileCache.new)
  file_cache.get(path) do
    content = YAML.load_file(path)
    Document.new(path, content, file_cache).resolve
  end
end

Instance Method Details

#resolveObject



16
17
18
# File 'lib/open_api_parser/document.rb', line 16

def resolve
  deeply_expand_refs(@content, nil)
end