Class: Google::Protobuf::Internal::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/google-protobuf-3.21.12-x86_64-linux/lib/google/protobuf/descriptor_dsl.rb

Constant Summary collapse

@@file_number =
AtomicCounter.new

Instance Method Summary collapse

Constructor Details

#initialize(pool) ⇒ Builder

Returns a new instance of Builder.



35
36
37
38
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/google-protobuf-3.21.12-x86_64-linux/lib/google/protobuf/descriptor_dsl.rb', line 35

def initialize(pool)
  @pool = pool
  @default_file = nil  # Constructed lazily
end

Instance Method Details

#add_enum(name, &block) ⇒ Object



50
51
52
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/google-protobuf-3.21.12-x86_64-linux/lib/google/protobuf/descriptor_dsl.rb', line 50

def add_enum(name, &block)
  internal_default_file.add_enum(name, &block)
end

#add_file(name, options = {}, &block) ⇒ Object



40
41
42
43
44
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/google-protobuf-3.21.12-x86_64-linux/lib/google/protobuf/descriptor_dsl.rb', line 40

def add_file(name, options={}, &block)
  builder = FileBuilder.new(@pool, name, options)
  builder.instance_eval(&block)
  internal_add_file(builder)
end

#add_message(name, &block) ⇒ Object



46
47
48
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/google-protobuf-3.21.12-x86_64-linux/lib/google/protobuf/descriptor_dsl.rb', line 46

def add_message(name, &block)
  internal_default_file.add_message(name, &block)
end

#buildObject

—- Internal methods, not part of the DSL —-



56
57
58
59
60
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/google-protobuf-3.21.12-x86_64-linux/lib/google/protobuf/descriptor_dsl.rb', line 56

def build
  if @default_file
    internal_add_file(@default_file)
  end
end