Skip to content
Permalink
Browse files

updated README, cleaned up debug code, updated dependencies. This closes

  • Loading branch information...
dhoss committed Oct 9, 2014
1 parent c1dbe26 commit a69100343fe314c537a212bbc55b82395ba9574c
Showing with 29 additions and 13 deletions.
  1. +4 −4 Gemfile
  2. +21 −3 README.md
  3. +0 −2 spec/treeify_spec.rb
  4. +4 −4 treeify.gemspec
@@ -1,11 +1,11 @@
source 'https://rubygems.org'

gem 'activerecord', '4.1.6'
gem 'rake'
gem 'pg'
gem 'rspec'
gem 'rake', '10.3.2'
gem 'pg', '0.17.1'
gem 'rspec', '3.1.0'

group :test, :development do
gem "codeclimate-test-reporter", group: :test, require: nil
gem 'database_cleaner'
gem 'database_cleaner', '1.3.0'
end
@@ -33,14 +33,32 @@ end
```
parent = Node.create(name: "parent node")
child = parent.children.create(name: "child 1")
parent.children << Node.new(name: "child 1")
child2 = child.children.create(name: "child 2")
parent.children.first.children << Node.new(name: "child 2")
```
4. Retrieve tree of stuff
```
parent.descendent_tree
# which should give you something like this:
[
{
"id"=>168,
"name"=>"child 1",
"parent_id"=>167,
"children"=>
[
{
"id"=>169,
"name"=>"child 2",
"parent_id"=>168,
"children"=>[]
}
]
}
]
parent.descendent_tree
```

License
@@ -100,8 +100,6 @@
parent = Node.create(name: "tree root")
parent.children << Node.new(name: "child 1")
parent.children.first.children << Node.new(name: "child 2")
p "CHILDREN"
pp parent.descendent_tree
child = parent.children.first
subchild = child.children.first
expect(parent.descendent_tree).to match_array([
@@ -10,9 +10,9 @@ Gem::Specification.new do |s|
s.files = "lib/treeify.rb"
s.license = "MIT"
s.homepage = "http://rubygems.org/gems/treeify"
s.add_runtime_dependency "pg"
s.add_runtime_dependency "pg", "0.17.1"
s.add_runtime_dependency "activerecord", "~> 4.1.6"
s.add_development_dependency "rspec"
s.add_development_dependency "rake"
s.add_development_dependency "database_cleaner"
s.add_development_dependency "rspec", "3.1.0"
s.add_development_dependency "rake", "10.3.2"
s.add_development_dependency "database_cleaner", "1.3.0"
end

0 comments on commit a691003

Please sign in to comment.
You can’t perform that action at this time.