Skip to content

Commit

Permalink
more Mojo::JSON::Pointer examples
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Apr 3, 2013
1 parent 46af5c6 commit b555858
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Changes
Expand Up @@ -7,7 +7,7 @@
- Improved WebSocket send method to stringify objects. (jberger)
- Improved documentation.
- Improved tests.
- Fixed RFC 6901 compliance of Mojo::JSON::Pointer.
- Fixed RFC 6901 compliance of Mojo::JSON::Pointer. (jberger, sri)

3.91 2013-03-17
- Improved bad charset handling in Mojo::DOM::HTML.
Expand Down
7 changes: 7 additions & 0 deletions lib/Mojo/JSON/Pointer.pm
Expand Up @@ -31,6 +31,8 @@ sub _pointer {

1;

=encoding utf8
=head1 NAME
Mojo::JSON::Pointer - JSON Pointers
Expand All @@ -57,10 +59,12 @@ Check if data structure contains a value that can be identified with the given
JSON Pointer.
# True
$pointer->contains({'♥' => 'mojolicious'}, '/♥');
$pointer->contains({foo => 'bar', baz => [4, 5, 6]}, '/foo');
$pointer->contains({foo => 'bar', baz => [4, 5, 6]}, '/baz/2');
# False
$pointer->contains({'♥' => 'mojolicious'}, '/☃');
$pointer->contains({foo => 'bar', baz => [4, 5, 6]}, '/bar');
$pointer->contains({foo => 'bar', baz => [4, 5, 6]}, '/baz/9');
Expand All @@ -70,6 +74,9 @@ JSON Pointer.
Extract value identified by the given JSON Pointer.
# "mojolicious"
$pointer->get({'♥' => 'mojolicious'}, '/♥');
# "bar"
$pointer->get({foo => 'bar', baz => [4, 5, 6]}, '/foo');
Expand Down

0 comments on commit b555858

Please sign in to comment.