Class: Gapic::Schema::Enum

Inherits:
Proto
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/gapic/schema/wrappers.rb

Overview

Wrapper for a protobuf enum.

Instance Attribute Summary collapse

Attributes inherited from Proto

#address, #descriptor, #docs, #parent

Instance Method Summary collapse

Methods inherited from Proto

#containing_api, #containing_file, #docs_leading_comments, #leading_comments, #leading_detached_comments, #path, #span, #trailing_comments

Constructor Details

#initialize(descriptor, address, docs, values) ⇒ Enum

Initializes a message object.

Parameters:



523
524
525
526
527
# File 'lib/gapic/schema/wrappers.rb', line 523

def initialize descriptor, address, docs, values
  super descriptor, address, docs
  @values = values || []
  @values.each { |v| v.parent = self }
end

Instance Attribute Details

#valuesObject (readonly)

@ return [EnumValue] the EnumValues contained in this file.



510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
# File 'lib/gapic/schema/wrappers.rb', line 510

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

  # @!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

#nameString

Returns the unqualified name of the Enum.

Returns:

  • (String)

    the unqualified name of the Enum.



534
535
536
537
538
# File 'lib/gapic/schema/wrappers.rb', line 534

def_delegators(
  :descriptor,
  :name,
  :options
)

#optionsArray<Google::Protobuf::EnumOptions>

Returns the options of the enum.

Returns:



534
535
536
537
538
# File 'lib/gapic/schema/wrappers.rb', line 534

def_delegators(
  :descriptor,
  :name,
  :options
)