Drops.Inflector.Acronyms (drops_inflector v0.1.0)

View Source

A set of acronyms for proper camelization and underscoring.

This module manages acronym rules that affect how words are transformed during camelization and underscoring operations.

Summary

Functions

Adds a new acronym rule.

Applies acronym rules to a word.

Creates a new empty Acronyms struct.

Returns the regex pattern for matching acronyms.

Types

t()

@type t() :: %Drops.Inflector.Acronyms{regex: Regex.t(), rules: map()}

Functions

add(struct, rule, replacement)

@spec add(t(), String.t(), String.t()) :: t()

Adds a new acronym rule.

apply_to(acronyms, word, opts \\ [])

@spec apply_to(t(), String.t(), keyword()) :: String.t()

Applies acronym rules to a word.

If the word (lowercased) matches an acronym rule, returns the proper acronym form. Otherwise, capitalizes the word if capitalize is true.

new()

@spec new() :: t()

Creates a new empty Acronyms struct.

regex(acronyms)

@spec regex(t()) :: Regex.t()

Returns the regex pattern for matching acronyms.