Class: Openapi3Parser::SourceInput::Raw
- Inherits:
-
Openapi3Parser::SourceInput
- Object
- Openapi3Parser::SourceInput
- Openapi3Parser::SourceInput::Raw
- Defined in:
- lib/openapi3_parser/source_input/raw.rb
Overview
An input of data (typically a Hash) to for initialising an OpenAPI document. Most likely used in development scenarios when you want to test things without creating/tweaking an OpenAPI source file
Instance Attribute Summary collapse
-
#base_url ⇒ String?
readonly
A url to be used for resolving relative references.
-
#raw_input ⇒ Object
readonly
The data for the document.
-
#working_directory ⇒ String?
readonly
A path to be used for resolving relative references.
Attributes inherited from Openapi3Parser::SourceInput
Instance Method Summary collapse
- #==(other) ⇒ Boolean
-
#initialize(raw_input, base_url: nil, working_directory: nil) ⇒ Raw
constructor
A new instance of Raw.
-
#inspect ⇒ Object
return [String].
- #resolve_next(reference) ⇒ SourceInput
- #to_s ⇒ String
Methods inherited from Openapi3Parser::SourceInput
#available?, #contents, #relative_to
Constructor Details
#initialize(raw_input, base_url: nil, working_directory: nil) ⇒ Raw
Returns a new instance of Raw.
24 25 26 27 28 29 30 |
# File 'lib/openapi3_parser/source_input/raw.rb', line 24 def initialize(raw_input, base_url: nil, working_directory: nil) @raw_input = raw_input @base_url = base_url working_directory ||= resolve_working_directory @working_directory = ::File.absolute_path(working_directory) super() end |
Instance Attribute Details
#base_url ⇒ String? (readonly)
A url to be used for resolving relative references
18 19 20 |
# File 'lib/openapi3_parser/source_input/raw.rb', line 18 def base_url @base_url end |
#raw_input ⇒ Object (readonly)
The data for the document
18 19 20 |
# File 'lib/openapi3_parser/source_input/raw.rb', line 18 def raw_input @raw_input end |
#working_directory ⇒ String? (readonly)
A path to be used for resolving relative references
18 19 20 |
# File 'lib/openapi3_parser/source_input/raw.rb', line 18 def working_directory @working_directory end |
Instance Method Details
#==(other) ⇒ Boolean
45 46 47 48 49 50 51 |
# File 'lib/openapi3_parser/source_input/raw.rb', line 45 def ==(other) return false unless other.instance_of?(self.class) raw_input == other.raw_input && base_url == other.base_url && working_directory == other.working_directory end |
#inspect ⇒ Object
return [String]
54 55 56 57 |
# File 'lib/openapi3_parser/source_input/raw.rb', line 54 def inspect %{#{self.class.name}(input: #{raw_input.inspect}, base_url: } + %{#{base_url}, working_directory: #{working_directory})} end |
#resolve_next(reference) ⇒ SourceInput
35 36 37 38 39 40 |
# File 'lib/openapi3_parser/source_input/raw.rb', line 35 def resolve_next(reference) ResolveNext.call(reference, self, base_url:, working_directory:) end |
#to_s ⇒ String
60 61 62 |
# File 'lib/openapi3_parser/source_input/raw.rb', line 60 def to_s raw_input.to_s end |