Class: Google::Protobuf::FileDescriptor
- Inherits:
-
Object
- Object
- Google::Protobuf::FileDescriptor
- Defined in:
- lib/google/protobuf/ffi/file_descriptor.rb
Instance Attribute Summary collapse
-
#descriptor_pool ⇒ Object
readonly
Returns the value of attribute descriptor_pool.
Instance Method Summary collapse
-
#initialize(file_def, descriptor_pool) ⇒ FileDescriptor
constructor
A new instance of FileDescriptor.
- #inspect ⇒ Object
- #name ⇒ Object
- #options ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(file_def, descriptor_pool) ⇒ FileDescriptor
Returns a new instance of FileDescriptor.
20 21 22 23 |
# File 'lib/google/protobuf/ffi/file_descriptor.rb', line 20 def initialize(file_def, descriptor_pool) @descriptor_pool = descriptor_pool @file_def = file_def end |
Instance Attribute Details
#descriptor_pool ⇒ Object (readonly)
Returns the value of attribute descriptor_pool.
18 19 20 |
# File 'lib/google/protobuf/ffi/file_descriptor.rb', line 18 def descriptor_pool @descriptor_pool end |
Instance Method Details
#inspect ⇒ Object
29 30 31 |
# File 'lib/google/protobuf/ffi/file_descriptor.rb', line 29 def inspect "#{self.class.name}: #{name}" end |
#name ⇒ Object
33 34 35 |
# File 'lib/google/protobuf/ffi/file_descriptor.rb', line 33 def name Google::Protobuf::FFI.file_def_name(@file_def) end |
#options ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/google/protobuf/ffi/file_descriptor.rb', line 37 def ||= begin size_ptr = ::FFI::MemoryPointer.new(:size_t, 1) temporary_arena = Google::Protobuf::FFI.create_arena buffer = Google::Protobuf::FFI.(@file_def, size_ptr, temporary_arena) opts = Google::Protobuf::FileOptions.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze) opts.clear_features() opts.freeze end end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/google/protobuf/ffi/file_descriptor.rb', line 25 def to_s inspect end |