Skip to content

Commit cbc54fd

Browse files
committed
Merge pull request #22 from c-rack/c-rack-patch-1
Solution: add usage example
2 parents 5a758dd + 0bae117 commit cbc54fd

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

README.md

+11-2
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,16 @@ false
6262
Keep in mind that `match!/2` throws an ArgumentError when you pass in a value
6363
that does not represent a valid IP address or when you try to match an IPv4
6464
address with an IPv6 range and vice-versa. We also provide `match/2`, a non-
65-
throwing interface that returns tagged tuples.
65+
throwing interface that returns tagged tuples:
66+
67+
```elixir
68+
iex(8)> cidr |> CIDR.match("1.2.3.100")
69+
{:ok, true}
70+
iex(9)> cidr |> CIDR.match("1.2.4.1")
71+
{:ok, false}
72+
iex(10)> cidr |> CIDR.match("1.2.3.1000")
73+
{:error, "Tuple is not a valid IP address."}
74+
```
6675

6776
## Contribution Process
6877

@@ -77,7 +86,7 @@ code changes.
7786
1. Check for [open issues](https://github.com/c-rack/cidr-elixir/issues) or
7887
[open a new issue](https://github.com/c-rack/cidr-elixir/issues/new) to start
7988
a discussion around a feature idea or a bug.
80-
2. Fork the [cidr-elixir repository on Github](https://github.com/c-rack/cidr-elixir)
89+
2. Fork the [cidr-elixir repository on GitHub](https://github.com/c-rack/cidr-elixir)
8190
to start making your changes.
8291
3. Write a test which shows that the bug was fixed or that the feature works as
8392
expected

0 commit comments

Comments
 (0)