README.md in glob-0.3.1 vs README.md in glob-0.4.0

- old
+ new

@@ -70,11 +70,11 @@ #=> } ``` Notice that the return result will have symbolized keys. -If the contains dots, then the result will use `\\.` as the escape sequence. +If the key contain dots, then the result will use `\\.` as the escape sequence. Similarly, you need to escape keys with dots when filtering results. ```ruby glob = Glob.new( formats: { @@ -100,9 +100,32 @@ glob.paths #=> ["formats.\\.rb"] glob.to_h #=> {:formats=>{:".rb"=>"Ruby"}} +``` + +You can set new keys by using `.set(path, value)`: + +```ruby +glob = Glob.new +glob << "*" +glob.set "a.b.c", "hello" + +glob.to_h +#=> {:a=>{:b=>{:c=>"hello"}}} + +glob.paths +#=> ["a.b.c"] + +# The non-hash value will be replaced in case the new path overlaps it +glob.set "a.b.c.d.e", "hello" + +glob.to_h +#=> {:a=>{:b=>{:c=>{:d=>{:e=>"hello"}}}}} + +glob.paths +#=> ["a.b.c.d.e"] ``` ## Maintainer - [Nando Vieira](https://github.com/fnando)