Class: Gapic::Presenters::SnippetPresenter::ClientInitializationPresenter
- Inherits:
-
Object
- Object
- Gapic::Presenters::SnippetPresenter::ClientInitializationPresenter
- Defined in:
- lib/gapic/presenters/snippet/client_initialization_presenter.rb
Overview
Presentation information about client object initialization
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.
Instance Method Summary collapse
-
#initialize(proto, json, phase1:, client_type:) ⇒ ClientInitializationPresenter
constructor
Create an client init presenter.
Constructor Details
#initialize(proto, json, phase1:, client_type:) ⇒ ClientInitializationPresenter
Create an client init presenter.
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/gapic/presenters/snippet/client_initialization_presenter.rb', line 35 def initialize proto, json, phase1:, client_type: @render_lines = [] if json&.key? "preClientInitialization" proto.pre_client_initialization.each_with_index do |stmt_proto, index| statement = StatementPresenter.new stmt_proto, json["preClientInitialization"][index] @render_lines += statement.render_lines end elsif phase1 @render_lines << "# Create a client object. The client can be reused for multiple calls." end @render_lines += build_create_code proto, client_type @render = @render_lines.join "\n" end |
Instance Attribute Details
#render ⇒ String (readonly)
The rendered code as a single string, possibly with line breaks
59 60 61 |
# File 'lib/gapic/presenters/snippet/client_initialization_presenter.rb', line 59 def render @render end |
#render_lines ⇒ Array<String> (readonly)
The lines of rendered code
53 54 55 |
# File 'lib/gapic/presenters/snippet/client_initialization_presenter.rb', line 53 def render_lines @render_lines end |