class Gapic::Schema::File

Wrapper for a protobuf file.

@!attribute [r] messages

@return [Enumerable<Message>] The top level messages contained in
  this file.

@!attribute [r] enums

@return [Enumerable<Enum>] The top level enums contained in this
  file.

@!attribute [r] services

@return [Enumerable<Service>] The services contained in this file.

@!attribute [r] resources

@return [Enumerable<Resource>] The top level resources contained in
  this file.

Attributes

enums[R]
messages[R]
registry[R]
resources[R]
services[R]

Public Class Methods

new(descriptor, address, docs, messages, enums, services, resources, generate, registry) click to toggle source

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 messages [Enumerable<Message>] The top level messages of this

file.

@param enums [Enumerable<Enum>] The top level enums of this file. @param services [Enumerable<Service>] The services of this file. @param resources [Enumerable<Resource>] The resources from this file. @param generate [Boolean] Whether this file should be generated.

Calls superclass method Gapic::Schema::Proto::new
# File lib/gapic/schema/wrappers.rb, line 412
def initialize descriptor, address, docs, messages, enums, services,
               resources, generate, registry
  super descriptor, address, docs
  @messages = messages || []
  @enums = enums || []
  @services = services || []
  @resources = resources || []
  @generate = generate
  @registry = registry

  # Apply parent
  @messages.each { |m| m.parent = self }
  @enums.each { |m| m.parent = self }
  @services.each { |m| m.parent = self }
  @resources.each { |m| m.parent = self }
end

Public Instance Methods

containing_file() click to toggle source
# File lib/gapic/schema/wrappers.rb, line 429
def containing_file
  self
end
generate?() click to toggle source
# File lib/gapic/schema/wrappers.rb, line 438
def generate?
  @generate
end
lookup(address) click to toggle source
# File lib/gapic/schema/wrappers.rb, line 433
def lookup address
  address = address.split(".").reject(&:empty?).join(".")
  @registry[address]
end
ruby_package() click to toggle source

@return [String] Ruby Package

# File lib/gapic/schema/wrappers.rb, line 443
def ruby_package
  options[:ruby_package] if options
end