Skip to content

Commit 7fe9bcc

Browse files
committed
Remove Spec.stream/2
1 parent 73ae2d4 commit 7fe9bcc

File tree

3 files changed

+0
-43
lines changed

3 files changed

+0
-43
lines changed

docs/cheatsheets/adoption.cheatmd

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ using the [`Matcha.Spec`](https://hexdocs.pm/matcha/Matcha.Spec.html) functions
5151

5252
- [`Matcha.Spec.call/2`](https://hexdocs.pm/matcha/Matcha.Spec.html#call/2)
5353
- [`Matcha.Spec.run/2`](https://hexdocs.pm/matcha/Matcha.Spec.html#run/2)
54-
- [`Matcha.Spec.stream/2`](https://hexdocs.pm/matcha/Matcha.Spec.html#stream/2)
5554

5655
```elixir
5756
require Matcha

docs/guides/adoption.livemd

-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ The [`Matcha.Context`](https://hexdocs.pm/matcha/Matcha.Context.html) documentat
145145

146146
- [`Matcha.Spec.call/2`](https://hexdocs.pm/matcha/Matcha.Spec.html#call/2)
147147
- [`Matcha.Spec.run/2`](https://hexdocs.pm/matcha/Matcha.Spec.html#run/2)
148-
- [`Matcha.Spec.stream/2`](https://hexdocs.pm/matcha/Matcha.Spec.html#stream/2)
149148

150149
## Using Matcha APIs
151150

lib/matcha/spec.ex

-41
Original file line numberDiff line numberDiff line change
@@ -148,47 +148,6 @@ defmodule Matcha.Spec do
148148
end
149149
end
150150

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-
192151
@spec valid?(t()) :: boolean()
193152
def valid?(%__MODULE__{} = spec) do
194153
case validate(spec) do

0 commit comments

Comments
 (0)