README.md in depth-0.0.2 vs README.md in depth-0.1.0
- old
+ new
@@ -109,10 +109,12 @@
### Enumeration
The messages signatures relating to enumeration are:
* `each` = yields `key_or_index` and `fragment`, returns the complex hash
+* `select` = yields `key_or_index`, `fragment`, returns a new complex hash
+* `reject` = yields `key_or_index`, `fragment`, returns a new complex hash
* `map` = yields `key_or_index`, `fragment` and `parent_type`, returns a new complex hash
* `map_values` = yields `fragment`, returns a new complex hash
* `map_keys` = yields `key_or_index`, returns a new complex hash
* `map!`, `map_keys!` and `map_keys_and_values!`, returns a new complex hash
* `reduce(memo)` = yields `memo`, `key` and `fragment`, returns memo
@@ -143,9 +145,39 @@
1. `x, 4`
2. `something, { "x" => 4 }`
3. `0, { "something" => { "x" => 4 } }`
4. `$and, [{ "something" => { "x" => 4 } }]`
+#### select
+
+```ruby
+ hash = { 'x' => 1, '$c' => 2, 'v' => { '$x' => :a }, '$f' => { 'a' => 3, '$l' => 4 }}
+
+ Depth::ComplexHash.new(hash).select do |key, fragment|
+ key =~ /^\$/
+ end
+```
+
+The above would yield:
+
+1. `x, 1`
+2. `$c, 2`
+3. `$x, a`
+4. `v, {"$x"=>:a}`
+5. `a, 3`
+6. `$l, 4`
+7. `$f, {"$l"=>4}`
+
+and with the boolean only selecting keys with a dollar sign
+it would return a new complex hash
+
+```ruby
+{ "$c" => 2, "$f" => { '$l' => 4 } }
+```
+
+#### reject
+
+Unsurprisingly this is the inverse of select.
#### map
Map yields both the current key/index and the current fragment,
expecting both returned in an array. I've yet to decide if