@@ -148,47 +148,6 @@ defmodule Matcha.Spec do
148
148
end
149
149
end
150
150
151
- @ spec stream ( t ( ) , Enumerable . t ( ) ) :: Enumerable . t ( )
152
- @ doc """
153
- Produces a `Stream` that filters out and manipulates elements of an `enumerable`.
154
-
155
- Elements of the `enumerable` that match one of the `spec`'s clauses
156
- will transformed as instructed.
157
- Elements that do not match will be filtered out of the result.
158
-
159
- Always returns a lazy `Stream` enumerable.
160
-
161
- ## Examples
162
-
163
- # FIXME: context stream logic broken, re-enable after fix
164
- # iex> require Matcha
165
- ...> Matcha.spec do
166
- ...> {amount, tax} when is_integer(amount) and amount < 0 -> {:charge, amount + tax}
167
- ...> end
168
- ...> |> Matcha.Spec.stream([
169
- ...> {9001, 0},
170
- ...> {-200, -2.50},
171
- ...> {-3, -0.5},
172
- ...> {:error, "bank was offline"},
173
- ...> {100, 0},
174
- ...> {-743, -16.0},
175
- ...> ])
176
- ...> |> Stream.take(2)
177
- ...> |> Enum.to_list
178
- [charge: -202.5, charge: -3.5]
179
-
180
-
181
- ## Note
182
-
183
- This function wraps the `enumerable` in a lazy `Stream`.
184
- If the `enumerable` is something you can safely convert
185
- to a list without going on forever or loading too much into memory,
186
- consider using `run/2` instead, as it is more efficient.
187
- """
188
- def stream ( % __MODULE__ { } = spec , enumerable ) do
189
- Context . stream ( spec , enumerable )
190
- end
191
-
192
151
@ spec valid? ( t ( ) ) :: boolean ( )
193
152
def valid? ( % __MODULE__ { } = spec ) do
194
153
case validate ( spec ) do
0 commit comments