petrovich_elixir v0.1.1 Petrovich.Parser View Source

Parser receives the name and case to infect it to.

Then it parses the rules to find the appropriate modifications. It then calls Applier to modify the value.

This module should not be used directly. Use Petrovich module instead.

Link to this section Summary

Functions

Parses name and gets modifiers for the given case

Pretty much the same as parse/4, but raises exception instead

Link to this section Functions

Link to this function parse(data, type, case_, gender) View Source
parse(String.t, atom, atom, atom | nil) ::
  {:ok, String.t} |
  :error

Parses name and gets modifiers for the given case.

Then it passes the name and modification rules to the Applier.

Examples

iex> Parser.parse("Николай", :firstname, :dative, :male)
{:ok, "Николаю"}

iex> Parser.parse("Пирогов", :lastname, :instrumental, :male)
{:ok, "Пироговым"}
Link to this function parse!(data, type, case_, gender) View Source
parse!(String.t, atom, atom, atom | nil) :: String.t

Pretty much the same as parse/4, but raises exception instead.

Examples

iex> Parser.parse!("Николай", :firstname, :dative, :male)
"Николаю"

iex> Parser.parse!("Пирогов", :lastname, :instrumental, :male)
"Пироговым"