Class: Gapic::Presenters::SnippetPresenter::SimpleResponseHandlingPresenter
- Inherits:
-
Object
- Object
- Gapic::Presenters::SnippetPresenter::SimpleResponseHandlingPresenter
- Includes:
- ResponseHandlingPresenterCommon
- Defined in:
- lib/gapic/presenters/snippet/response_handling_presenters.rb
Overview
Presentation information about simple response handling
Instance Attribute Summary collapse
-
#render ⇒ String
readonly
The rendered code as a single string, possibly with line breaks.
-
#render_lines ⇒ Array<String>
readonly
The lines of rendered code.
-
#response_name ⇒ String?
readonly
The name of the response variable, or nil for no response handling.
Instance Method Summary collapse
-
#initialize(proto, _json, response_type:, phase1:) ⇒ SimpleResponseHandlingPresenter
constructor
Create a simple response handling presenter.
Constructor Details
#initialize(proto, _json, response_type:, phase1:) ⇒ SimpleResponseHandlingPresenter
Create a simple response handling presenter
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/gapic/presenters/snippet/response_handling_presenters.rb', line 50 def initialize proto, _json, response_type:, phase1: @response_name = compute_response_name proto, phase1 @render_lines = if @response_name && phase1 [ "# The returned object is of type #{response_type}.", "p #{@response_name}" ] else [] end @render = @render_lines.join "\n" end |
Instance Attribute Details
#render ⇒ String (readonly)
The rendered code as a single string, possibly with line breaks
74 75 76 |
# File 'lib/gapic/presenters/snippet/response_handling_presenters.rb', line 74 def render @render end |
#render_lines ⇒ Array<String> (readonly)
The lines of rendered code
68 69 70 |
# File 'lib/gapic/presenters/snippet/response_handling_presenters.rb', line 68 def render_lines @render_lines end |
#response_name ⇒ String? (readonly)
The name of the response variable, or nil for no response handling
80 81 82 |
# File 'lib/gapic/presenters/snippet/response_handling_presenters.rb', line 80 def response_name @response_name end |