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
1111 following built-in types: keywords, records and functions.
1212 """
1313
14- @ only [ List , Function , Record , Atom ]
14+ @ only [ List , Record , Atom ]
1515
1616 @ doc """
1717 Receives the element being accessed and the access item.
@@ -53,20 +53,9 @@ defimpl Access, for: Atom do
5353 def access ( nil , _ ) do
5454 nil
5555 end
56+
5657 def access ( atom , _ ) do
5758 raise "The access protocol can only be invoked for atoms at " <>
5859 "compilation time, tried to invoke it for #{ inspect atom } "
5960 end
6061end
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
1313 assert nil [ :foo ] == nil
1414 end
1515
16- test :function do
17- function = fn x -> x == :foo end
18- assert function [ :foo ] == true
19- assert function [ :bar ] == false
20- end
21-
2216 # Test nil at compilation time does not fail
2317 # and that @config[:foo] has proper precedence.
2418 nil = @ config [ :foo ]
You can’t perform that action at this time.
0 commit comments