Class: Gapic::Presenters::SnippetPresenter::StatementPresenter
- Inherits:
-
Object
- Object
- Gapic::Presenters::SnippetPresenter::StatementPresenter
- Defined in:
- lib/gapic/presenters/snippet/statement_presenter.rb
Overview
Presentation information about a statement
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) ⇒ StatementPresenter
constructor
Create a statement presenter.
Constructor Details
#initialize(proto, json) ⇒ StatementPresenter
Create a statement presenter.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/gapic/presenters/snippet/statement_presenter.rb', line 33 def initialize proto, json @render_lines = if json&.key? "declaration" declaration_lines proto.declaration, json["declaration"] elsif json&.key? "standardOutput" output_lines proto.standard_output, json["standardOutput"] elsif json&.key? "return" return_lines proto.return, json["return"] elsif json&.key? "conditional" conditional_lines proto.conditional, json["conditional"] elsif json&.key? "iteration" iteration_lines proto.iteration, json["iteration"] else ["# Unknown statement omitted here."] end @render = @render_lines.join "\n" end |
Instance Attribute Details
#render ⇒ String (readonly)
The rendered code as a single string, possibly with line breaks
61 62 63 |
# File 'lib/gapic/presenters/snippet/statement_presenter.rb', line 61 def render @render end |
#render_lines ⇒ Array<String> (readonly)
The lines of rendered code
55 56 57 |
# File 'lib/gapic/presenters/snippet/statement_presenter.rb', line 55 def render_lines @render_lines end |