Dogma v0.1.16 Dogma.Util.Name

Utility functions for analysing names.

Summary

Functions

Returns true if the name is not in PascalCase

Returns true if the name is not in snake_case

Returns true if the name is in PascalCase

Returns true if the name is in snake_case

Functions

not_pascal_case?(name)

Returns true if the name is not in PascalCase

iex> Dogma.Util.Name.not_pascal_case?( "GenServer" )
false

iex> Dogma.Util.Name.not_pascal_case?( "fooBar" )
true

iex> Dogma.Util.Name.not_pascal_case?( "foo_bar" )
true
not_snake_case?(name)

Returns true if the name is not in snake_case

iex> Dogma.Util.Name.not_snake_case?( "foo_bar" )
false

iex> Dogma.Util.Name.not_snake_case?( "fooBar" )
true
pascal_case?(name)

Returns true if the name is in PascalCase

iex> Dogma.Util.Name.pascal_case?( "GenServer" )
true

iex> Dogma.Util.Name.pascal_case?( "IO" )
true

iex> Dogma.Util.Name.pascal_case?( "fooBar" )
false

iex> Dogma.Util.Name.pascal_case?( "foo_bar" )
false
snake_case?(name)

Returns true if the name is in snake_case.

iex> Dogma.Util.Name.snake_case?("to_string")
true

iex> Dogma.Util.Name.snake_case?("starts_with?")
true

iex> Dogma.Util.Name.snake_case?("read!")
true

iex> Dogma.Util.Name.snake_case?("foo_bar_baz")
true

iex> Dogma.Util.Name.snake_case?("fooBar")
false

iex> Dogma.Util.Name.snake_case?("Foobar")
false

iex> Dogma.Util.Name.snake_case?("foo_Bar")
false