   """
   @spec pretty(String.t) :: String.t
   def pretty(str) do
-    c = number(str)
-    "(#{String.slice(c, 0, 3)}) #{String.slice(c, 3, 3)}-#{String.slice(c,6,4)}"
+    "(#{area_code(str)}) #{prefix(str)}-#{line(str)}"
   end
 end

  """
  @spec area_code(String.t) :: String.t
  def area_code(str) do
    number(str) |> String.slice(0, 3)
  end

  @doc """

  @spec number(String.t) :: String.t
  def number(raw) do
    raw
    |> to_parts
    |> to_string
  end

  @spec to_parts(String.t) :: [String.t]
  defp to_parts(raw) do
    Regex.run(~r/^\D*?1?\D*?(\d{3})\D*(\d{3})\D*(\d{4})$/, raw, [capture: :all_but_first]) || ["000", "000", "0000"]
  end

  @doc """
  Get the area code of a phone number.
