Class: Protobug::Compiler::FileDescriptorProto

Inherits:
Google::Protobuf::FileDescriptorProto
  • Object
show all
Includes:
Descriptor
Defined in:
lib/protobug/compiler.rb

Instance Attribute Summary collapse

Attributes included from Descriptor

#descriptor, #file, #parent, #source_loc

Instance Method Summary collapse

Methods included from Descriptor

#full_name, included, #initialize, #to_constant

Instance Attribute Details

#file_to_generateObject

Returns the value of attribute file_to_generate.



170
171
172
# File 'lib/protobug/compiler.rb', line 170

def file_to_generate
  @file_to_generate
end

Instance Method Details

#file_nameObject



156
157
158
159
160
161
162
163
164
# File 'lib/protobug/compiler.rb', line 156

def file_name
  ruby_package = options.ruby_package if options&.ruby_package?
  prefix = if ruby_package
             ruby_package.split("::").map!(&:downcase).join("/")
           else
             package.split(".").map!(&:downcase).join("/")
           end
  name.gsub(%r{^.*?([^/]+)\.proto$}, "#{prefix}/\\1_pb.rb")
end

#loc_by_path(path) ⇒ Object



166
167
168
# File 'lib/protobug/compiler.rb', line 166

def loc_by_path(path)
  source_code_info.location.find { |loc| loc.path == path }
end