README.md in hash_flatten-0.1.0 vs README.md in hash_flatten-0.2.0
- old
+ new
@@ -1,19 +1,33 @@
# HashFlatten
-Just one method i sometimes miss on Hash. It recursivelly flattens hash to be just one level deep.
+Two methods i sometimes miss on Hash.
+## `#destructure`
+
hash = { a: 'a',
b: { a: 'b' },
c: { b: { a: 'c' } } }
-hash.flatten =>
+hash.destructure =>
{ 'a' => 'a',
'b.a' => 'b',
'c.b.a' => 'c' }
+## `#structure`
+
+hash = { 'a' => 'a',
+ 'b.a' => 'b',
+ 'c.b.a' => 'c' }
+
+hash.structure =>
+
+{ 'a' => 'a',
+ 'b' => { 'a' => 'b' },
+ 'c' => { 'b' => { 'a' => 'c' } } }
+
## Installation
Add this line to your application's Gemfile:
```ruby
@@ -34,10 +48,10 @@
```
class MyClass
using HashFlatten
end
```
-now you can call `#flatten` on hashes in `MyClass`.
+now you can call `#destructure` od `#structure` on hashes in `MyClass`.
Here is an excellent blog post on refinements if you didn't use them before: http://interblah.net/why-is-nobody-using-refinements
## License