Class: OpenapiContracts::Doc::Parser
- Inherits:
-
Object
- Object
- OpenapiContracts::Doc::Parser
- Defined in:
- lib/openapi_contracts/doc/parser.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(dir) ⇒ Parser
constructor
A new instance of Parser.
- #parse(path) ⇒ Object
Constructor Details
#initialize(dir) ⇒ Parser
Returns a new instance of Parser.
7 8 9 |
# File 'lib/openapi_contracts/doc/parser.rb', line 7 def initialize(dir) @dir = dir end |
Class Method Details
.call(dir, filename) ⇒ Object
3 4 5 |
# File 'lib/openapi_contracts/doc/parser.rb', line 3 def self.call(dir, filename) new(dir).parse(filename) end |
Instance Method Details
#parse(path) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/openapi_contracts/doc/parser.rb', line 11 def parse(path) abs_path = @dir.join(path) data = parse_file(abs_path, translate: false) data.deep_merge! merge_components data = join_partials(abs_path.dirname, data) nullable_to_type!(data) end |