module Proto::Generator::NamingPolicy

Overview

NamingPolicy converts proto identifiers to Crystal identifiers.

Rules (matching protoc-gen-go / protoc-gen-python conventions adapted for Crystal):

Defined in:

proto/generator/naming.cr

Class Method Summary

Class Method Detail

def self.camelize(s : String) : String #

snake_case → CamelCase


[View source]
def self.fq_type_to_crystal(fq : String) : String #

proto fully-qualified type ".foo.bar.Baz.Inner" → "Foo::Bar::Baz::Inner"


[View source]
def self.message_name(name : String) : String #

Convert a proto message/enum name (already CamelCase) to a Crystal class/enum name. Nested names are NOT joined here — the caller passes the leaf name.


[View source]
def self.package_to_module(package : String) : String | Nil #

Convert a proto package string to a Crystal module path. "foo.bar_baz" → "Foo::BarBaz" "" → nil


[View source]