MyAncestry
Make search of objects parents/childrem/brothers .....
Installation
Add this line to your application's Gemfile:
gem 'my_ancestry'
And then execute:
$ bundle
Or install it yourself as:
$ gem install my_ancestry
Usage
list = [ { id:1, name: "couto", ancestry:nil }, { id:2, name: "teste", ancestry:"000001" }, { id:3, name: "teste2", ancestry:"0001" } ]
result = MyAncestry.new(list,{:id=> :id, :ancestry_id => :ancestry})
brothers = result.brothers_of(2)
childrem = result.childrem_of(1)
parent = result.parent_of(3) .....
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
- Execure the "THE BEER-WARE LICENSE".
#tnks for Digaoddc (https://github.com/digaoddc/)