Class: Gapic::Schema::File
- Extended by:
- Forwardable
- Defined in:
- lib/gapic/schema/wrappers.rb
Overview
Wrapper for a protobuf file.
Instance Attribute Summary collapse
-
#enums ⇒ Enumerable<Enum>
readonly
The top level enums contained in this file.
-
#messages ⇒ Enumerable<Message>
readonly
The top level messages contained in this file.
-
#registry ⇒ Object
readonly
Returns the value of attribute registry.
-
#resources ⇒ Enumerable<Resource>
readonly
The top level resources contained in this file.
-
#services ⇒ Enumerable<Service>
readonly
The services contained in this file.
Attributes inherited from Proto
#address, #descriptor, #docs, #parent
Instance Method Summary collapse
- #containing_file ⇒ Object
-
#dependency ⇒ Array<String>
Names of files imported by this file.
- #generate? ⇒ Boolean
-
#initialize(descriptor, address, docs, messages, enums, services, resources, generate, registry) ⇒ File
constructor
Initializes a message object.
- #lookup(address) ⇒ Object
-
#name ⇒ String
File name, relative to root of source tree.
-
#options ⇒ Google::Protobuf::FileOptions
The options of this file.
-
#package ⇒ String
Package of the file.
-
#public_dependency ⇒ Array<Integer>
Indexes of the public imported files in the dependency list returned by #dependency.
-
#ruby_package ⇒ String
Ruby Package.
Methods inherited from Proto
#containing_api, #docs_leading_comments, #leading_comments, #leading_detached_comments, #option_extension_names, #option_named, #path, #span, #trailing_comments
Constructor Details
#initialize(descriptor, address, docs, messages, enums, services, resources, generate, registry) ⇒ File
Initializes a message object.
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 |
# File 'lib/gapic/schema/wrappers.rb', line 533 def initialize descriptor, address, docs, , enums, services, resources, generate, registry super descriptor, address, docs = || [] @enums = enums || [] @services = services || [] @resources = resources || [] @generate = generate @registry = registry # Apply parent .each { |m| m.parent = self } @enums.each { |m| m.parent = self } @services.each { |m| m.parent = self } @resources.each { |m| m.parent = self } end |
Instance Attribute Details
#enums ⇒ Enumerable<Enum> (readonly)
Returns The top level enums contained in this file.
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 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
# File 'lib/gapic/schema/wrappers.rb', line 511 class File < Proto extend Forwardable attr_reader :messages attr_reader :enums attr_reader :services attr_reader :resources attr_reader :registry # 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. def initialize descriptor, address, docs, , enums, services, resources, generate, registry super descriptor, address, docs = || [] @enums = enums || [] @services = services || [] @resources = resources || [] @generate = generate @registry = registry # Apply parent .each { |m| m.parent = self } @enums.each { |m| m.parent = self } @services.each { |m| m.parent = self } @resources.each { |m| m.parent = self } end def containing_file self end def lookup address address = address.split(".").reject(&:empty?).join(".") @registry[address] end def generate? @generate end # @return [String] Ruby Package def ruby_package option_named "ruby_package" end # @!method name # @return [String] file name, relative to root of source tree. # @!method package # @return [String] package of the file. e.g. "foo", "foo.bar", etc. # @!method dependency # @return [Array<String>] Names of files imported by this file. # @!method public_dependency # @return [Array<Integer>] Indexes of the public imported files in the # dependency list returned by #dependency. # @!method options # @return [Google::Protobuf::FileOptions] the options of this file. def_delegators( :descriptor, :name, :package, :dependency, :public_dependency, :options ) end |
#messages ⇒ Enumerable<Message> (readonly)
Returns The top level messages contained in this file.
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 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
# File 'lib/gapic/schema/wrappers.rb', line 511 class File < Proto extend Forwardable attr_reader :messages attr_reader :enums attr_reader :services attr_reader :resources attr_reader :registry # 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. def initialize descriptor, address, docs, , enums, services, resources, generate, registry super descriptor, address, docs = || [] @enums = enums || [] @services = services || [] @resources = resources || [] @generate = generate @registry = registry # Apply parent .each { |m| m.parent = self } @enums.each { |m| m.parent = self } @services.each { |m| m.parent = self } @resources.each { |m| m.parent = self } end def containing_file self end def lookup address address = address.split(".").reject(&:empty?).join(".") @registry[address] end def generate? @generate end # @return [String] Ruby Package def ruby_package option_named "ruby_package" end # @!method name # @return [String] file name, relative to root of source tree. # @!method package # @return [String] package of the file. e.g. "foo", "foo.bar", etc. # @!method dependency # @return [Array<String>] Names of files imported by this file. # @!method public_dependency # @return [Array<Integer>] Indexes of the public imported files in the # dependency list returned by #dependency. # @!method options # @return [Google::Protobuf::FileOptions] the options of this file. def_delegators( :descriptor, :name, :package, :dependency, :public_dependency, :options ) end |
#registry ⇒ Object (readonly)
Returns the value of attribute registry.
518 519 520 |
# File 'lib/gapic/schema/wrappers.rb', line 518 def registry @registry end |
#resources ⇒ Enumerable<Resource> (readonly)
Returns The top level resources contained in this file.
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 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
# File 'lib/gapic/schema/wrappers.rb', line 511 class File < Proto extend Forwardable attr_reader :messages attr_reader :enums attr_reader :services attr_reader :resources attr_reader :registry # 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. def initialize descriptor, address, docs, , enums, services, resources, generate, registry super descriptor, address, docs = || [] @enums = enums || [] @services = services || [] @resources = resources || [] @generate = generate @registry = registry # Apply parent .each { |m| m.parent = self } @enums.each { |m| m.parent = self } @services.each { |m| m.parent = self } @resources.each { |m| m.parent = self } end def containing_file self end def lookup address address = address.split(".").reject(&:empty?).join(".") @registry[address] end def generate? @generate end # @return [String] Ruby Package def ruby_package option_named "ruby_package" end # @!method name # @return [String] file name, relative to root of source tree. # @!method package # @return [String] package of the file. e.g. "foo", "foo.bar", etc. # @!method dependency # @return [Array<String>] Names of files imported by this file. # @!method public_dependency # @return [Array<Integer>] Indexes of the public imported files in the # dependency list returned by #dependency. # @!method options # @return [Google::Protobuf::FileOptions] the options of this file. def_delegators( :descriptor, :name, :package, :dependency, :public_dependency, :options ) end |
#services ⇒ Enumerable<Service> (readonly)
Returns The services contained in this file.
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 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
# File 'lib/gapic/schema/wrappers.rb', line 511 class File < Proto extend Forwardable attr_reader :messages attr_reader :enums attr_reader :services attr_reader :resources attr_reader :registry # 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. def initialize descriptor, address, docs, , enums, services, resources, generate, registry super descriptor, address, docs = || [] @enums = enums || [] @services = services || [] @resources = resources || [] @generate = generate @registry = registry # Apply parent .each { |m| m.parent = self } @enums.each { |m| m.parent = self } @services.each { |m| m.parent = self } @resources.each { |m| m.parent = self } end def containing_file self end def lookup address address = address.split(".").reject(&:empty?).join(".") @registry[address] end def generate? @generate end # @return [String] Ruby Package def ruby_package option_named "ruby_package" end # @!method name # @return [String] file name, relative to root of source tree. # @!method package # @return [String] package of the file. e.g. "foo", "foo.bar", etc. # @!method dependency # @return [Array<String>] Names of files imported by this file. # @!method public_dependency # @return [Array<Integer>] Indexes of the public imported files in the # dependency list returned by #dependency. # @!method options # @return [Google::Protobuf::FileOptions] the options of this file. def_delegators( :descriptor, :name, :package, :dependency, :public_dependency, :options ) end |
Instance Method Details
#containing_file ⇒ Object
550 551 552 |
# File 'lib/gapic/schema/wrappers.rb', line 550 def containing_file self end |
#dependency ⇒ Array<String>
Returns Names of files imported by this file.
579 580 581 582 583 584 585 586 |
# File 'lib/gapic/schema/wrappers.rb', line 579 def_delegators( :descriptor, :name, :package, :dependency, :public_dependency, :options ) |
#generate? ⇒ Boolean
559 560 561 |
# File 'lib/gapic/schema/wrappers.rb', line 559 def generate? @generate end |
#lookup(address) ⇒ Object
554 555 556 557 |
# File 'lib/gapic/schema/wrappers.rb', line 554 def lookup address address = address.split(".").reject(&:empty?).join(".") @registry[address] end |
#name ⇒ String
Returns file name, relative to root of source tree.
579 580 581 582 583 584 585 586 |
# File 'lib/gapic/schema/wrappers.rb', line 579 def_delegators( :descriptor, :name, :package, :dependency, :public_dependency, :options ) |
#options ⇒ Google::Protobuf::FileOptions
Returns the options of this file.
579 580 581 582 583 584 585 586 |
# File 'lib/gapic/schema/wrappers.rb', line 579 def_delegators( :descriptor, :name, :package, :dependency, :public_dependency, :options ) |
#package ⇒ String
Returns package of the file. e.g. "foo", "foo.bar", etc.
579 580 581 582 583 584 585 586 |
# File 'lib/gapic/schema/wrappers.rb', line 579 def_delegators( :descriptor, :name, :package, :dependency, :public_dependency, :options ) |
#public_dependency ⇒ Array<Integer>
Returns Indexes of the public imported files in the dependency list returned by #dependency.
579 580 581 582 583 584 585 586 |
# File 'lib/gapic/schema/wrappers.rb', line 579 def_delegators( :descriptor, :name, :package, :dependency, :public_dependency, :options ) |
#ruby_package ⇒ String
Returns Ruby Package.
564 565 566 |
# File 'lib/gapic/schema/wrappers.rb', line 564 def ruby_package option_named "ruby_package" end |