Class: Gapic::Presenters::SnippetPresenter::TypePresenter
- Inherits:
-
Object
- Object
- Gapic::Presenters::SnippetPresenter::TypePresenter
- Defined in:
- lib/gapic/presenters/snippet/type_presenter.rb
Overview
Presentation information about a type
Instance Attribute Summary collapse
-
#render ⇒ String
readonly
The rendered type string.
Instance Method Summary collapse
-
#initialize(proto, json) ⇒ TypePresenter
constructor
Create a type presenter.
Constructor Details
#initialize(proto, json) ⇒ TypePresenter
Create a type presenter.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/gapic/presenters/snippet/type_presenter.rb', line 34 def initialize proto, json @render = if json&.key? "scalarType" SCALAR_TYPE_MAPPING[proto.scalar_type] || "Object" elsif json&.key? "bytesType" "String" elsif json&.key? "messageType" proto_to_ruby proto.. elsif json&.key? "enumType" proto_to_ruby proto.enum_type.enum_full_name elsif json&.key? "repeatedType" repeated_render proto, json elsif json&.key? "mapType" map_render proto, json else "Object" end end |
Instance Attribute Details
#render ⇒ String (readonly)
The rendered type string.
57 58 59 |
# File 'lib/gapic/presenters/snippet/type_presenter.rb', line 57 def render @render end |