File tree Expand file tree Collapse file tree 2 files changed +2
-19
lines changed Expand file tree Collapse file tree 2 files changed +2
-19
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ defprotocol Access do
11
11
following built-in types: keywords, records and functions.
12
12
"""
13
13
14
- @ only [ List , Function , Record , Atom ]
14
+ @ only [ List , Record , Atom ]
15
15
16
16
@ doc """
17
17
Receives the element being accessed and the access item.
@@ -53,20 +53,9 @@ defimpl Access, for: Atom do
53
53
def access ( nil , _ ) do
54
54
nil
55
55
end
56
+
56
57
def access ( atom , _ ) do
57
58
raise "The access protocol can only be invoked for atoms at " <>
58
59
"compilation time, tried to invoke it for #{ inspect atom } "
59
60
end
60
61
end
61
-
62
- defimpl Access , for: Function do
63
- @ doc """
64
- The Access protocol for functions simply invokes
65
- the function passing the item as argument. This
66
- is useful because it allows a function to be
67
- passed as argument in places a dict would also fit.
68
- """
69
- def access ( function , item ) do
70
- function . ( item )
71
- end
72
- end
Original file line number Diff line number Diff line change @@ -13,12 +13,6 @@ defmodule AccessTest do
13
13
assert nil [ :foo ] == nil
14
14
end
15
15
16
- test :function do
17
- function = fn x -> x == :foo end
18
- assert function [ :foo ] == true
19
- assert function [ :bar ] == false
20
- end
21
-
22
16
# Test nil at compilation time does not fail
23
17
# and that @config[:foo] has proper precedence.
24
18
nil = @ config [ :foo ]
You can’t perform that action at this time.
0 commit comments