ExUssd.Nav (ExUssd v1.0.0-rc-1) View Source

USSD Nav module

Link to this section Summary

Functions

Its used to create a new ExUssd Nav menu.

Convert the USSD navigation menu to string

Link to this section Types

Specs

t() :: %ExUssd.Nav{
  bottom: integer(),
  delimiter: String.t(),
  left: integer(),
  match: String.t(),
  name: String.t(),
  orientation: atom(),
  reverse: boolean(),
  right: integer(),
  show: boolean(),
  top: integer(),
  type: atom()
}

Link to this section Functions

Specs

new(keyword()) :: %ExUssd.Nav{
  bottom: term(),
  delimiter: term(),
  left: term(),
  match: term(),
  name: term(),
  orientation: term(),
  reverse: term(),
  right: term(),
  show: term(),
  top: term(),
  type: term()
}

Its used to create a new ExUssd Nav menu.

Parameters

  • opts - Nav arguments

Example

iex> ExUssd.new(name: "home") |> ExUssd.set(nav: Nav.new(type: :next, name: "MORE", match: "98"))

iex> ExUssd.new(name: "home") 
    |> ExUssd.set(nav: [
    ExUssd.Nav.new(type: :home, name: "HOME", match: "00", reverse: true, orientation: :vertical)
    ExUssd.Nav.new(type: :back, name: "BACK", match: "0", right: 1),
    ExUssd.Nav.new(type: :next, name: "MORE", match: "98")
  ])

Specs

to_string([t()]) :: String.t()

Convert the USSD navigation menu to string

## Parameters

  • nav - Nav Struct
  • depth - depth of the nav menu
  • max - max value of the menu list

Example

iex> Nav.new(type: :next, name: "MORE", match: "98") |> Nav.to_string()
"MORE:98"

iex> nav = [
      ExUssd.Nav.new(type: :home, name: "HOME", match: "00", reverse: true, orientation: :vertical),
      ExUssd.Nav.new(type: :back, name: "BACK", match: "0", right: 1),
      ExUssd.Nav.new(type: :next, name: "MORE", match: "98")
    ]
iex> ExUssd.Nav.to_string(nav)
"HOME:00
 BACK:0 MORE:98"
Link to this function

to_string(nav, depth \\ 2, max \\ 999)

View Source

Specs

to_string(t(), integer(), integer()) :: String.t()
Link to this function

to_string(navs, depth, menu_list, max)

View Source

Specs

to_string([t()], integer(), [ExUssd.t()], integer()) :: String.t()