Class: Gapic::Schema::Enum
- Extended by:
- Forwardable
- Defined in:
- lib/gapic/schema/wrappers.rb
Overview
Wrapper for a protobuf enum.
Instance Attribute Summary collapse
-
#values ⇒ Object
readonly
@ return [EnumValue] the EnumValues contained in this file.
Attributes inherited from Proto
#address, #descriptor, #docs, #parent
Instance Method Summary collapse
-
#initialize(descriptor, address, docs, values) ⇒ Enum
constructor
Initializes a message object.
-
#is_deprecated? ⇒ Boolean
True if this enum is marked as deprecated, false otherwise.
-
#name ⇒ String
The unqualified name of the Enum.
-
#options ⇒ Array<Google::Protobuf::EnumOptions>
The options of the enum.
Methods inherited from Proto
#containing_api, #containing_file, #docs_leading_comments, #leading_comments, #leading_detached_comments, #option_extension_names, #option_named, #path, #span, #trailing_comments
Constructor Details
#initialize(descriptor, address, docs, values) ⇒ Enum
Initializes a message object.
594 595 596 597 598 |
# File 'lib/gapic/schema/wrappers.rb', line 594 def initialize descriptor, address, docs, values super descriptor, address, docs @values = values || [] @values.each { |v| v.parent = self } end |
Instance Attribute Details
#values ⇒ Object (readonly)
@ return [EnumValue] the EnumValues contained in this file.
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 |
# File 'lib/gapic/schema/wrappers.rb', line 581 class Enum < Proto extend Forwardable attr_reader :values # Initializes a message object. # @param descriptor [Google::Protobuf::DescriptorProto] the protobuf # representation of this service. # @param address [Enumerable<String>] The address of the proto. See # #address for more info. # @param docs [Google::Protobuf::SourceCodeInfo::Location] The docs # of the proto. See #docs for more info. # @param values [Enumerable<EnumValue>] The EnumValues of this enum. def initialize descriptor, address, docs, values super descriptor, address, docs @values = values || [] @values.each { |v| v.parent = self } end # @return [Boolean] True if this enum is marked as deprecated, false # otherwise. def is_deprecated? option_named "deprecated" end # @!method name # @return [String] the unqualified name of the Enum. # @!method options # @return [Array<Google::Protobuf::EnumOptions>] the options of the # enum. def_delegators( :descriptor, :name, :options ) end |
Instance Method Details
#is_deprecated? ⇒ Boolean
Returns True if this enum is marked as deprecated, false otherwise.
602 603 604 |
# File 'lib/gapic/schema/wrappers.rb', line 602 def is_deprecated? option_named "deprecated" end |
#name ⇒ String
Returns the unqualified name of the Enum.
611 612 613 614 615 |
# File 'lib/gapic/schema/wrappers.rb', line 611 def_delegators( :descriptor, :name, :options ) |
#options ⇒ Array<Google::Protobuf::EnumOptions>
Returns the options of the enum.
611 612 613 614 615 |
# File 'lib/gapic/schema/wrappers.rb', line 611 def_delegators( :descriptor, :name, :options ) |