Class: Protobug::Compiler::MethodDescriptorProto

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

Instance Attribute Summary

Attributes included from Descriptor

#descriptor, #file, #parent, #source_loc

Instance Method Summary collapse

Methods included from Descriptor

#full_name, included, #initialize, #to_constant

Instance Method Details

#ruby_method_nameObject



207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/protobug/compiler.rb', line 207

def ruby_method_name
  return name unless /[A-Z-]|::/.match?(name)

  word = name.gsub("::", "/")
  # word.gsub!(inflections.acronyms_underscore_regex) do
  #   "#{::Regexp.last_match(1) && "_"}#{::Regexp.last_match(2).downcase}"
  # end
  word.gsub!(/(?<=[A-Z])(?=[A-Z][a-z])|(?<=[a-z\d])(?=[A-Z])/, "_")
  word.tr!("-", "_")
  word.downcase!
  word
end