ruby-protobuf / protobuf

A pure ruby implementation of Google's Protocol Buffers
https://github.com/ruby-protobuf
MIT License
462 stars 101 forks source link

Generate module name: snake_case to CamelCase in case of `package` name. #403

Open manhdaovan opened 4 years ago

manhdaovan commented 4 years ago

For instance, i have:

# a.proto file
package abc_def;
message ghi {}

Then, when generating ruby source, i got:

# a.pb.rb
module Abc_def
  class Ghi {}
end

The package named abc_def should be generated to AbcDef module, instead of Abc_def, shouldn't it?

I checked this issue: https://github.com/ruby-protobuf/protobuf/issues/81#issuecomment-16066840, but the case of the package name was not mentioned there.

film42 commented 4 years ago

Good find. This is indeed a bug!

film42 commented 4 years ago

Looking closer, we do have tests that enforce this behavior. That is, I see tests failing when I change the modulize helper method to use camelize. I still think we should fix this, though.