README.md in glob-0.1.0 vs README.md in glob-0.2.0

- old
+ new

@@ -21,10 +21,17 @@ $ gem install glob ## Usage +There are two types of paths: `include` and `exclude`. + +- The `include` path adds that node to the new hash. +- The `exclude` path is the one started by `!`, and will prevent that path from being added. + +The latest rules have more precedence; that means that if you have the rule `*.messages.*`, then add a following rule as `!*.messages.bye`, all `*.messages.*` but `*.messages.bye` will be included. + ```ruby glob = Glob.new( site: { settings: { name: "Site name", @@ -36,16 +43,16 @@ name: "User name" } } ) -result = glob.query("*.settings.*") +glob << "*.settings.*" -result.paths +glob.paths #=> ["site.settings.name", "site.settings.url", "user.settings.name"] -result.to_h +glob.to_h #=> { #=> site: { #=> settings: { #=> name: "Site name" #=> } @@ -57,12 +64,9 @@ #=> } #=> } ``` Notice that the return result will have symbolized keys. - -If you're planning to do one-off searches, then you can use -`Glob.query(target, paths)` instead. ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.