Class: Google::Protobuf::Internal::Builder
- Inherits:
-
Object
- Object
- Google::Protobuf::Internal::Builder
- Defined in:
- lib/google/protobuf/descriptor_dsl.rb
Constant Summary collapse
- @@file_number =
AtomicCounter.new
Instance Method Summary collapse
- #add_enum(name, &block) ⇒ Object
- #add_file(name, options = {}, &block) ⇒ Object
- #add_message(name, &block) ⇒ Object
-
#build ⇒ Object
—- Internal methods, not part of the DSL —-.
-
#initialize(pool) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(pool) ⇒ Builder
Returns a new instance of Builder.
35 36 37 38 |
# File '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/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/google/protobuf/descriptor_dsl.rb', line 40 def add_file(name, ={}, &block) builder = FileBuilder.new(@pool, name, ) builder.instance_eval(&block) internal_add_file(builder) end |
#add_message(name, &block) ⇒ Object
46 47 48 |
# File 'lib/google/protobuf/descriptor_dsl.rb', line 46 def (name, &block) internal_default_file.(name, &block) end |
#build ⇒ Object
—- Internal methods, not part of the DSL —-
56 57 58 59 60 |
# File 'lib/google/protobuf/descriptor_dsl.rb', line 56 def build if @default_file internal_add_file(@default_file) end end |