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
- #syntax ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(file_def, descriptor_pool) ⇒ FileDescriptor
Returns a new instance of FileDescriptor.
21 22 23 24 |
# File 'lib/google/protobuf/ffi/file_descriptor.rb', line 21 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.
19 20 21 |
# File 'lib/google/protobuf/ffi/file_descriptor.rb', line 19 def descriptor_pool @descriptor_pool end |
Instance Method Details
#inspect ⇒ Object
30 31 32 |
# File 'lib/google/protobuf/ffi/file_descriptor.rb', line 30 def inspect "#{self.class.name}: #{name}" end |
#name ⇒ Object
45 46 47 |
# File 'lib/google/protobuf/ffi/file_descriptor.rb', line 45 def name Google::Protobuf::FFI.file_def_name(@file_def) end |
#options ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'lib/google/protobuf/ffi/file_descriptor.rb', line 49 def @options ||= 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) Google::Protobuf::FileOptions.decode(buffer.read_string_length(size_ptr.read(:size_t)).force_encoding("ASCII-8BIT").freeze).send(:internal_deep_freeze) end end |
#syntax ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/google/protobuf/ffi/file_descriptor.rb', line 34 def syntax case Google::Protobuf::FFI.file_def_syntax(@file_def) when :Proto3 :proto3 when :Proto2 :proto2 else nil end end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/google/protobuf/ffi/file_descriptor.rb', line 26 def to_s inspect end |