Class: Openapi3Parser::SourceInput
- Inherits:
-
Object
- Object
- Openapi3Parser::SourceInput
- Defined in:
- lib/openapi3_parser/source_input.rb,
lib/openapi3_parser/source_input/raw.rb,
lib/openapi3_parser/source_input/url.rb,
lib/openapi3_parser/source_input/file.rb,
lib/openapi3_parser/source_input/resolve_next.rb,
lib/openapi3_parser/source_input/string_parser.rb
Overview
An abstract class which is used to provide a foundation for classes that represent the different means of input an OpenAPI document can have. It is used to represent the underlying source of the data which is used as a source within an OpenAPI document.
Defined Under Namespace
Classes: File, Raw, ResolveNext, StringParser, Url
Instance Attribute Summary collapse
-
#access_error ⇒ Error::InaccessibleInput?
readonly
The current value of access_error.
-
#parse_error ⇒ Error::UnparsableInput?
readonly
The current value of parse_error.
Instance Method Summary collapse
-
#==(_other) ⇒ Object
Used to determine whether a different instance of SourceInput is the same file/data.
-
#available? ⇒ Boolean
Indicates that the data within this input is suitable (i.e. can parse underlying JSON or YAML) for trying to use as part of a Document.
-
#contents ⇒ Object
The parsed data from the input.
-
#relative_to(_source_input) ⇒ String
The relative path, if possible, for this source_input compared to a different one.
-
#resolve_next(_reference) ⇒ Object
For a given reference use the context of the current SourceInput to determine which file is required for the reference.
Instance Attribute Details
#access_error ⇒ Error::InaccessibleInput? (readonly)
Returns the current value of access_error.
20 21 22 |
# File 'lib/openapi3_parser/source_input.rb', line 20 def access_error @access_error end |
#parse_error ⇒ Error::UnparsableInput? (readonly)
Returns the current value of parse_error.
20 21 22 |
# File 'lib/openapi3_parser/source_input.rb', line 20 def parse_error @parse_error end |
Instance Method Details
#==(_other) ⇒ Object
Used to determine whether a different instance of SourceInput is the same file/data
37 |
# File 'lib/openapi3_parser/source_input.rb', line 37 def ==(_other); end |
#available? ⇒ Boolean
Indicates that the data within this input is suitable (i.e. can parse underlying JSON or YAML) for trying to use as part of a Document
25 26 27 |
# File 'lib/openapi3_parser/source_input.rb', line 25 def available? access_error.nil? && parse_error.nil? end |
#contents ⇒ Object
The parsed data from the input
45 46 47 48 49 |
# File 'lib/openapi3_parser/source_input.rb', line 45 def contents raise access_error if access_error raise parse_error if parse_error @contents end |
#relative_to(_source_input) ⇒ String
The relative path, if possible, for this source_input compared to a different one. Defaults to empty string and should be specialised in subclasses
56 57 58 |
# File 'lib/openapi3_parser/source_input.rb', line 56 def relative_to(_source_input) "" end |
#resolve_next(_reference) ⇒ Object
For a given reference use the context of the current SourceInput to determine which file is required for the reference. This allows references to use relative file paths because we can combine them witt the current SourceInput location to determine the next one
33 |
# File 'lib/openapi3_parser/source_input.rb', line 33 def resolve_next(_reference); end |