TypeClass v1.2.0 TypeClass.Utility.Module View Source

Naming convention helpers to help follow TypeClass conventions

Link to this section Summary

Functions

Generate the module name for the protocol portion of the class. Does not nest Protocols

Generate the module name for the protocol portion of the class. Does not nest Protocols

Generate a submodule name. If the module already ends in the requested submodule, it will return the module name unchanged

Link to this section Types

Link to this section Functions

Link to this function append(parent_module, submodule) View Source
Link to this function to_property(base_module) View Source
to_property(module) :: module

Generate the module name for the protocol portion of the class. Does not nest Protocols.

Examples

iex> to_property MyClass.Awesome
MyClass.Awesome.Property

iex> to_property MyClass.Awesome.Property
MyClass.Awesome.roperty
Link to this function to_protocol(base_module) View Source
to_protocol(module) :: module

Generate the module name for the protocol portion of the class. Does not nest Protocols.

Examples

iex> to_protocol MyClass.Awesome
MyClass.Awesome.Protocol

iex> to_protocol MyClass.Awesome.Protocol
MyClass.Awesome.Protocol
Link to this function to_submodule(base_module, child_name) View Source
to_submodule(module, String.t | module) :: module

Generate a submodule name. If the module already ends in the requested submodule, it will return the module name unchanged.

Examples

iex> MyModule.Awesome |> to_submodule(Submodule)
MyModule.Awesome.Submodule

iex> MyModule.Awesome |> to_submodule("Submodule")
MyModule.Awesome.Submodule

iex> MyModule.Awesome.Submodule |> to_submodule(Submodule)
MyModule.Awesome.Submodule