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:



460
461
462
463
464
# File 'lib/gapic/schema/wrappers.rb', line 460

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.



448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
# File 'lib/gapic/schema/wrappers.rb', line 448

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

#name ⇒ String

Returns the unqualified name of the Enum.

Returns:

  • (String) —

    the unqualified name of the Enum.



471
472
473
474
475
# File 'lib/gapic/schema/wrappers.rb', line 471

def_delegators(
  :descriptor,
  :name,
  :options
)

#options ⇒ Array<Google::Protobuf::EnumOptions>

Returns the options of the enum.

Returns:



471
472
473
474
475
# File 'lib/gapic/schema/wrappers.rb', line 471

def_delegators(
  :descriptor,
  :name,
  :options
)