Navigation Menu

Skip to content

Commit

Permalink
updated README, cleaned up debug code, updated dependencies. This closes
Browse files Browse the repository at this point in the history
  • Loading branch information
dhoss committed Oct 9, 2014
1 parent c1dbe26 commit a691003
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
8 changes: 4 additions & 4 deletions Gemfile
@@ -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
24 changes: 21 additions & 3 deletions README.md
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions spec/treeify_spec.rb
Expand Up @@ -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([
Expand Down
8 changes: 4 additions & 4 deletions treeify.gemspec
Expand Up @@ -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.