Permalink
Browse files

Root name space is now the same as the repo name

  • Loading branch information...
1 parent 4ab1042 commit 4226b3397bc74665c0801dfcde58a918cc06b818 @BjRo committed Jan 20, 2014
View
@@ -17,8 +17,7 @@ Add to your mix.exs
### Usage ###
```elixir
-Ap.start_link
-import AP
+import Apex
ap data
```
View
@@ -1,5 +0,0 @@
-defmodule AP do
- def ap(data, options // []) do
- IO.puts(AP.Format.format(data, options))
- end
-end
View
@@ -1,65 +0,0 @@
-defprotocol AP.Format do
- def format(data, options // [])
-end
-
-defimpl AP.Format, for: BitString do
- def format(data, _ // []), do: "\"#{data}\"" <> AP.Format.Utils.new_line
-end
-
-defimpl AP.Format, for: Integer do
- def format(data, _ // []), do: "#{data}" <> AP.Format.Utils.new_line
-end
-
-defimpl AP.Format, for: Float do
- def format(data, _ // []) do
- "#{float_to_binary(data, decimals: 15, compact: true)}" <> AP.Format.Utils.new_line
- end
-end
-
-defimpl AP.Format, for: Atom do
- def format(data, _ // []), do: "#{data}" <> AP.Format.Utils.new_line
-end
-
-defimpl AP.Format, for: List do
- def format(data, options // []), do: AP.Format.Seq.format(data, options)
-end
-
-defimpl AP.Format, for: Range do
- def format({name, lower_bound, upper_bound}, options // []) do
- "##{name} #{lower_bound}..#{upper_bound}" <> AP.Format.Utils.new_line
- end
-end
-
-defimpl AP.Format, for: PID do
- def format(data, options // []) do
- inspect(data) <> AP.Format.Utils.new_line
- end
-end
-
-defimpl AP.Format, for: Function do
- def format(data, options // []) do
- inspect(data) <> AP.Format.Utils.new_line
- end
-end
-
-defimpl AP.Format, for: HashDict do
- def format(data, options // []) do
- AP.Format.Seq.format(
- Dict.to_list(data),
- options,
- start_token: "#HashDict <",
- end_token: ">",
- numbers: false)
- end
-end
-
-defimpl AP.Format, for: HashSet do
- def format(data, options // []) do
- AP.Format.Seq.format(
- Set.to_list(data),
- options,
- start_token: "#HashSet <",
- end_token: ">",
- numbers: false)
- end
-end
View
@@ -0,0 +1,5 @@
+defmodule Apex do
+ def ap(data, options // []) do
+ IO.puts(Apex.Format.format(data, options))
+ end
+end
View
@@ -0,0 +1,65 @@
+defprotocol Apex.Format do
+ def format(data, options // [])
+end
+
+defimpl Apex.Format, for: BitString do
+ def format(data, _ // []), do: "\"#{data}\"" <> Apex.Format.Utils.new_line
+end
+
+defimpl Apex.Format, for: Integer do
+ def format(data, _ // []), do: "#{data}" <> Apex.Format.Utils.new_line
+end
+
+defimpl Apex.Format, for: Float do
+ def format(data, _ // []) do
+ "#{float_to_binary(data, decimals: 15, compact: true)}" <> Apex.Format.Utils.new_line
+ end
+end
+
+defimpl Apex.Format, for: Atom do
+ def format(data, _ // []), do: "#{data}" <> Apex.Format.Utils.new_line
+end
+
+defimpl Apex.Format, for: List do
+ def format(data, options // []), do: Apex.Format.Seq.format(data, options)
+end
+
+defimpl Apex.Format, for: Range do
+ def format({name, lower_bound, upper_bound}, options // []) do
+ "##{name} #{lower_bound}..#{upper_bound}" <> Apex.Format.Utils.new_line
+ end
+end
+
+defimpl Apex.Format, for: PID do
+ def format(data, options // []) do
+ inspect(data) <> Apex.Format.Utils.new_line
+ end
+end
+
+defimpl Apex.Format, for: Function do
+ def format(data, options // []) do
+ inspect(data) <> Apex.Format.Utils.new_line
+ end
+end
+
+defimpl Apex.Format, for: HashDict do
+ def format(data, options // []) do
+ Apex.Format.Seq.format(
+ Dict.to_list(data),
+ options,
+ start_token: "#HashDict <",
+ end_token: ">",
+ numbers: false)
+ end
+end
+
+defimpl Apex.Format, for: HashSet do
+ def format(data, options // []) do
+ Apex.Format.Seq.format(
+ Set.to_list(data),
+ options,
+ start_token: "#HashSet <",
+ end_token: ">",
+ numbers: false)
+ end
+end
@@ -1,5 +1,5 @@
-defmodule AP.Format.Seq do
- import AP.Format.Utils
+defmodule Apex.Format.Seq do
+ import Apex.Format.Utils
def format(data, options, config // []) do
pre = start_token(config) <> new_line
@@ -15,7 +15,7 @@ defmodule AP.Format.Seq do
defp do_format({entry, i}, options, config) do
number = if numbers?(config), do: "[#{i}] ", else: ""
- indent(options) <> number <> AP.Format.format(entry, options)
+ indent(options) <> number <> Apex.Format.format(entry, options)
end
defp start_token(config), do: config[:start_token] || "["
@@ -1,10 +1,10 @@
-defimpl AP.Format, for: Tuple do
- import AP.Format.Utils
+defimpl Apex.Format, for: Tuple do
+ import Apex.Format.Utils
def format(data, options // []), do: do_format(data, options)
defp do_format({key, value}, options) when is_atom(key) do
- "#{key}: " <> AP.Format.format(value, options)
+ "#{key}: " <> Apex.Format.format(value, options)
end
defp do_format(data, options) do
@@ -14,6 +14,6 @@ defimpl AP.Format, for: Tuple do
{ "{", tuple_to_list(data) }
end
- AP.Format.Seq.format(entries, options, start_token: pre, end_token: "}")
+ Apex.Format.Seq.format(entries, options, start_token: pre, end_token: "}")
end
end
@@ -1,4 +1,4 @@
-defmodule AP.Format.Utils do
+defmodule Apex.Format.Utils do
@default_indent 2
@default_level 0
View
@@ -1,8 +1,8 @@
-defmodule AP.Mixfile do
+defmodule Apex.Mixfile do
use Mix.Project
def project do
- [ app: :ap,
+ [ app: :apex,
version: "0.0.1",
elixir: "~> 0.12.2",
deps: deps ]
@@ -1,6 +1,6 @@
-defmodule AP.Format.List.Test do
+defmodule Apex.Format.List.Test do
use ExUnit.Case
- import AP.Format.Utils
+ import Apex.Format.Utils
test "#next_indent_level" do
options = []
View
@@ -1,6 +1,6 @@
-defmodule AP.Format.Test do
+defmodule Apex.Format.Test do
use ExUnit.Case
- import AP.Format
+ import Apex.Format
test "Can format a list of strings" do
assert format(%w(a b c d), color: false) == """
@@ -62,7 +62,7 @@ defmodule AP.Format.Test do
defrecord User, first_name: nil, last_name: nil
test "Can format records" do
assert format(User.new(first_name: "John", last_name: "Doe"), color: false) == """
- #Elixir.AP.Format.Test.User {
+ #Elixir.Apex.Format.Test.User {
[0] first_name: "John"
[1] last_name: "Doe"
}
@@ -81,7 +81,7 @@ defmodule AP.Format.Test do
test "Can format function" do
f = fn(a) -> "#{a}" end
- assert format(f, color: false) =~ %r(#Function<0.\d+ in AP.Format.Test.test Can format function/1>\n)
+ assert format(f, color: false) =~ %r(#Function<0.\d+ in Apex.Format.Test.test Can format function/1>\n)
end
test "Can format Dicts" do

0 comments on commit 4226b33

Please sign in to comment.