tree_support 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/examples/0130_node_class_example.rb +2 -2
- data/examples/0150_acts_as_tree.rb +0 -13
- data/examples/0160_acts_as_tree_and_list.rb +1 -37
- data/examples/0220_it_will_not_be_strange_to_tojson.rb +1 -1
- data/examples/0240_memory_record.rb +2 -2
- data/examples/Gemfile.lock +92 -86
- data/examples/demo.rb +19 -19
- data/lib/tree_support/node.rb +10 -5
- data/lib/tree_support/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc32b4d87ac536560722828526789df4b1bae17d0872c75aafdee114bf22f187
|
4
|
+
data.tar.gz: 5974d22129202db8a20e92d0b99d567a4afe5ea8f1a4af709fd785105b647a82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b5365879d03dc973df6de1caf2ca9d33e217ea8649fd2129a953cc288e97c3aa806763fe04a74be01aca33ce1c501ad1a7edfa3e098fbd22bd2cdc1219f24cb
|
7
|
+
data.tar.gz: 4492c979351ef948321ba535d1d0172852275d89c0c136a6f981279c026a62fc2434895e6c2ba3c994fb5c4c5742a875fcdc86861d49c22465db5096e18b5593
|
data/.travis.yml
CHANGED
@@ -52,10 +52,10 @@ root = Node.new("*root*") do
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
# TreeSupport.tree
|
55
|
+
# The object passed to TreeSupport.tree needs only to respond to parent.children and name
|
56
56
|
puts TreeSupport.tree(root)
|
57
57
|
|
58
|
-
#
|
58
|
+
# How do I put a method to stringify an object?
|
59
59
|
Node.include(TreeSupport::Stringify)
|
60
60
|
puts root.to_s_tree
|
61
61
|
# >> *root*
|
@@ -66,19 +66,6 @@ Node.extend(ActsAsTree::TreeView)
|
|
66
66
|
Node.tree_view(:name)
|
67
67
|
|
68
68
|
# puts TreeSupport.tree(root)
|
69
|
-
# ~> from -:8:in `<main>'
|
70
|
-
# ~> from -:8:in `require'
|
71
|
-
# ~> from /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/acts_as_tree-2.4.0/lib/acts_as_tree.rb:322:in `<top (required)>'
|
72
|
-
# ~> from /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/acts_as_tree-2.4.0/lib/acts_as_tree.rb:322:in `require'
|
73
|
-
# ~> from /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/acts_as_tree-2.4.0/lib/acts_as_tree/active_record/acts/tree.rb:1:in `<top (required)>'
|
74
|
-
# ~> from /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/acts_as_tree-2.4.0/lib/acts_as_tree/active_record/acts/tree.rb:1:in `require'
|
75
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.0/lib/active_support/core_ext/hash/transform_values.rb:11: warning: method redefined; discarding old transform_values
|
76
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.0/lib/active_support/core_ext/hash/transform_values.rb:23: warning: method redefined; discarding old transform_values!
|
77
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/concurrent-ruby-1.0.2/lib/concurrent/map.rb:230: warning: constant ::Fixnum is deprecated
|
78
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/concurrent-ruby-1.0.2/lib/concurrent/map.rb:230: warning: constant ::Fixnum is deprecated
|
79
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/concurrent-ruby-1.0.2/lib/concurrent/map.rb:230: warning: constant ::Fixnum is deprecated
|
80
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/concurrent-ruby-1.0.2/lib/concurrent/map.rb:230: warning: constant ::Fixnum is deprecated
|
81
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/arel-7.1.0/lib/arel/nodes/casted.rb:14: warning: instance variable @class not initialized
|
82
69
|
# >> root
|
83
70
|
# >> |_ *root*
|
84
71
|
# >> | |_ Battle
|
@@ -74,44 +74,8 @@ end
|
|
74
74
|
|
75
75
|
puts TreeSupport.tree(root) {|e| "#{e.name}(#{e.position})"}
|
76
76
|
|
77
|
-
# acts_as_tree + acts_as_list
|
77
|
+
# acts_as_tree + acts_as_list accident in destroy_all
|
78
78
|
Node.destroy_all rescue $! # => #<ActiveRecord::RecordNotFound: Couldn't find Node with 'id'=2>
|
79
|
-
# ~> from -:8:in `<main>'
|
80
|
-
# ~> from -:8:in `require'
|
81
|
-
# ~> from /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/acts_as_tree-2.4.0/lib/acts_as_tree.rb:322:in `<top (required)>'
|
82
|
-
# ~> from /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/acts_as_tree-2.4.0/lib/acts_as_tree.rb:322:in `require'
|
83
|
-
# ~> from /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/acts_as_tree-2.4.0/lib/acts_as_tree/active_record/acts/tree.rb:1:in `<top (required)>'
|
84
|
-
# ~> from /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/acts_as_tree-2.4.0/lib/acts_as_tree/active_record/acts/tree.rb:1:in `require'
|
85
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.0/lib/active_support/core_ext/hash/transform_values.rb:11: warning: method redefined; discarding old transform_values
|
86
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.0/lib/active_support/core_ext/hash/transform_values.rb:23: warning: method redefined; discarding old transform_values!
|
87
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/concurrent-ruby-1.0.2/lib/concurrent/map.rb:230: warning: constant ::Fixnum is deprecated
|
88
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/concurrent-ruby-1.0.2/lib/concurrent/map.rb:230: warning: constant ::Fixnum is deprecated
|
89
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/concurrent-ruby-1.0.2/lib/concurrent/map.rb:230: warning: constant ::Fixnum is deprecated
|
90
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/concurrent-ruby-1.0.2/lib/concurrent/map.rb:230: warning: constant ::Fixnum is deprecated
|
91
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/arel-7.1.0/lib/arel/nodes/casted.rb:14: warning: instance variable @class not initialized
|
92
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
93
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
94
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
95
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
96
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
97
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
98
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
99
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
100
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
101
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
102
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
103
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
104
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
105
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
106
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
107
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
108
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
109
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
110
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activerecord-5.0.0/lib/active_record/sanitization.rb:163: warning: too many arguments for format string
|
111
|
-
# ~> /usr/local/var/rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/arel-7.1.0/lib/arel/nodes/casted.rb:14: warning: instance variable @class not initialized
|
112
|
-
# ~> !XMP1512801308_58182_9031![1] => ActiveRecord::RecordNotFound #<ActiveRecord::RecordNotFound: Couldn't find Node with 'id'=2>
|
113
|
-
# ~> root
|
114
|
-
# ~> _xmp_1512801308_58182_55846
|
115
79
|
# >> *root*(1)
|
116
80
|
# >> ├─Battle(1)
|
117
81
|
# >> │ ├─Attack(1)
|
@@ -3,7 +3,7 @@ require "bundler/setup"
|
|
3
3
|
require "tree_support"
|
4
4
|
require "memory_record"
|
5
5
|
|
6
|
-
class
|
6
|
+
class TreeModel
|
7
7
|
include MemoryRecord
|
8
8
|
memory_record [
|
9
9
|
{key: :a, name: "A", parent: nil},
|
@@ -28,7 +28,7 @@ class Foo
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
puts
|
31
|
+
puts TreeModel.find_all(&:root?).collect(&:to_s_tree)
|
32
32
|
# >> A
|
33
33
|
# >> └─B
|
34
34
|
# >> └─C
|
data/examples/Gemfile.lock
CHANGED
@@ -1,123 +1,129 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
tree_support (0.
|
4
|
+
tree_support (0.1.4)
|
5
5
|
activesupport
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
actioncable (5.
|
11
|
-
actionpack (= 5.
|
12
|
-
nio4r (~>
|
13
|
-
websocket-driver (
|
14
|
-
actionmailer (5.
|
15
|
-
actionpack (= 5.
|
16
|
-
actionview (= 5.
|
17
|
-
activejob (= 5.
|
10
|
+
actioncable (5.2.1)
|
11
|
+
actionpack (= 5.2.1)
|
12
|
+
nio4r (~> 2.0)
|
13
|
+
websocket-driver (>= 0.6.1)
|
14
|
+
actionmailer (5.2.1)
|
15
|
+
actionpack (= 5.2.1)
|
16
|
+
actionview (= 5.2.1)
|
17
|
+
activejob (= 5.2.1)
|
18
18
|
mail (~> 2.5, >= 2.5.4)
|
19
19
|
rails-dom-testing (~> 2.0)
|
20
|
-
actionpack (5.
|
21
|
-
actionview (= 5.
|
22
|
-
activesupport (= 5.
|
20
|
+
actionpack (5.2.1)
|
21
|
+
actionview (= 5.2.1)
|
22
|
+
activesupport (= 5.2.1)
|
23
23
|
rack (~> 2.0)
|
24
|
-
rack-test (
|
24
|
+
rack-test (>= 0.6.3)
|
25
25
|
rails-dom-testing (~> 2.0)
|
26
26
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
-
actionview (5.
|
28
|
-
activesupport (= 5.
|
27
|
+
actionview (5.2.1)
|
28
|
+
activesupport (= 5.2.1)
|
29
29
|
builder (~> 3.1)
|
30
|
-
|
30
|
+
erubi (~> 1.4)
|
31
31
|
rails-dom-testing (~> 2.0)
|
32
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.
|
33
|
-
activejob (5.
|
34
|
-
activesupport (= 5.
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
33
|
+
activejob (5.2.1)
|
34
|
+
activesupport (= 5.2.1)
|
35
35
|
globalid (>= 0.3.6)
|
36
|
-
activemodel (5.
|
37
|
-
activesupport (= 5.
|
38
|
-
activerecord (5.
|
39
|
-
activemodel (= 5.
|
40
|
-
activesupport (= 5.
|
41
|
-
arel (
|
42
|
-
|
36
|
+
activemodel (5.2.1)
|
37
|
+
activesupport (= 5.2.1)
|
38
|
+
activerecord (5.2.1)
|
39
|
+
activemodel (= 5.2.1)
|
40
|
+
activesupport (= 5.2.1)
|
41
|
+
arel (>= 9.0)
|
42
|
+
activestorage (5.2.1)
|
43
|
+
actionpack (= 5.2.1)
|
44
|
+
activerecord (= 5.2.1)
|
45
|
+
marcel (~> 0.3.1)
|
46
|
+
activesupport (5.2.1)
|
43
47
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
44
|
-
i18n (
|
48
|
+
i18n (>= 0.7, < 2)
|
45
49
|
minitest (~> 5.1)
|
46
50
|
tzinfo (~> 1.1)
|
47
|
-
acts_as_list (0.
|
51
|
+
acts_as_list (0.9.16)
|
48
52
|
activerecord (>= 3.0)
|
49
|
-
acts_as_tree (2.
|
53
|
+
acts_as_tree (2.8.0)
|
50
54
|
activerecord (>= 3.0.0)
|
51
|
-
arel (
|
52
|
-
builder (3.2.
|
53
|
-
byebug (
|
54
|
-
concurrent-ruby (1.0.
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
arel (9.0.0)
|
56
|
+
builder (3.2.3)
|
57
|
+
byebug (10.0.2)
|
58
|
+
concurrent-ruby (1.0.5)
|
59
|
+
crass (1.0.4)
|
60
|
+
erubi (1.7.1)
|
61
|
+
globalid (0.4.1)
|
62
|
+
activesupport (>= 4.2.0)
|
58
63
|
gviz (0.3.5)
|
59
64
|
thor
|
60
|
-
i18n (
|
61
|
-
|
65
|
+
i18n (1.1.0)
|
66
|
+
concurrent-ruby (~> 1.0)
|
67
|
+
loofah (2.2.2)
|
68
|
+
crass (~> 1.0.2)
|
62
69
|
nokogiri (>= 1.5.9)
|
63
|
-
mail (2.
|
64
|
-
|
65
|
-
|
66
|
-
|
70
|
+
mail (2.7.0)
|
71
|
+
mini_mime (>= 0.1.1)
|
72
|
+
marcel (0.3.3)
|
73
|
+
mimemagic (~> 0.3.2)
|
74
|
+
memory_record (0.0.14)
|
67
75
|
activesupport
|
68
|
-
method_source (0.
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
bundler (>= 1.3.0, < 2.0)
|
92
|
-
railties (= 5.0.0)
|
76
|
+
method_source (0.9.0)
|
77
|
+
mimemagic (0.3.2)
|
78
|
+
mini_mime (1.0.1)
|
79
|
+
mini_portile2 (2.3.0)
|
80
|
+
minitest (5.11.3)
|
81
|
+
nio4r (2.3.1)
|
82
|
+
nokogiri (1.8.4)
|
83
|
+
mini_portile2 (~> 2.3.0)
|
84
|
+
rack (2.0.5)
|
85
|
+
rack-test (1.1.0)
|
86
|
+
rack (>= 1.0, < 3)
|
87
|
+
rails (5.2.1)
|
88
|
+
actioncable (= 5.2.1)
|
89
|
+
actionmailer (= 5.2.1)
|
90
|
+
actionpack (= 5.2.1)
|
91
|
+
actionview (= 5.2.1)
|
92
|
+
activejob (= 5.2.1)
|
93
|
+
activemodel (= 5.2.1)
|
94
|
+
activerecord (= 5.2.1)
|
95
|
+
activestorage (= 5.2.1)
|
96
|
+
activesupport (= 5.2.1)
|
97
|
+
bundler (>= 1.3.0)
|
98
|
+
railties (= 5.2.1)
|
93
99
|
sprockets-rails (>= 2.0.0)
|
94
|
-
rails-dom-testing (2.0.
|
95
|
-
activesupport (>= 4.2.0
|
96
|
-
nokogiri (
|
97
|
-
rails-html-sanitizer (1.0.
|
98
|
-
loofah (~> 2.
|
99
|
-
railties (5.
|
100
|
-
actionpack (= 5.
|
101
|
-
activesupport (= 5.
|
100
|
+
rails-dom-testing (2.0.3)
|
101
|
+
activesupport (>= 4.2.0)
|
102
|
+
nokogiri (>= 1.6)
|
103
|
+
rails-html-sanitizer (1.0.4)
|
104
|
+
loofah (~> 2.2, >= 2.2.2)
|
105
|
+
railties (5.2.1)
|
106
|
+
actionpack (= 5.2.1)
|
107
|
+
activesupport (= 5.2.1)
|
102
108
|
method_source
|
103
109
|
rake (>= 0.8.7)
|
104
|
-
thor (>= 0.
|
105
|
-
rake (
|
106
|
-
sprockets (3.7.
|
110
|
+
thor (>= 0.19.0, < 2.0)
|
111
|
+
rake (12.3.1)
|
112
|
+
sprockets (3.7.2)
|
107
113
|
concurrent-ruby (~> 1.0)
|
108
114
|
rack (> 1, < 3)
|
109
|
-
sprockets-rails (3.
|
115
|
+
sprockets-rails (3.2.1)
|
110
116
|
actionpack (>= 4.0)
|
111
117
|
activesupport (>= 4.0)
|
112
118
|
sprockets (>= 3.0.0)
|
113
|
-
sqlite3 (1.3.
|
114
|
-
thor (0.
|
115
|
-
thread_safe (0.3.
|
116
|
-
tzinfo (1.2.
|
119
|
+
sqlite3 (1.3.13)
|
120
|
+
thor (0.20.0)
|
121
|
+
thread_safe (0.3.6)
|
122
|
+
tzinfo (1.2.5)
|
117
123
|
thread_safe (~> 0.1)
|
118
|
-
websocket-driver (0.
|
124
|
+
websocket-driver (0.7.0)
|
119
125
|
websocket-extensions (>= 0.1.0)
|
120
|
-
websocket-extensions (0.1.
|
126
|
+
websocket-extensions (0.1.3)
|
121
127
|
|
122
128
|
PLATFORMS
|
123
129
|
ruby
|
@@ -134,4 +140,4 @@ DEPENDENCIES
|
|
134
140
|
tree_support!
|
135
141
|
|
136
142
|
BUNDLED WITH
|
137
|
-
1.16.
|
143
|
+
1.16.2
|
data/examples/demo.rb
CHANGED
@@ -105,22 +105,22 @@ TreeSupport.graphviz(root, take: 3, drop: 1).output("../images/take_drop.png")
|
|
105
105
|
# >> Break
|
106
106
|
# >> ├─Stop
|
107
107
|
# >> └─Recover
|
108
|
-
# >>
|
109
|
-
# >> ├─
|
110
|
-
# >> │ ├─
|
111
|
-
# >> │ │ ├─
|
112
|
-
# >> │ │ ├─
|
113
|
-
# >> │ │ │ ├─
|
114
|
-
# >> │ │ │ └─
|
115
|
-
# >> │ │ └─
|
116
|
-
# >> │ └─
|
117
|
-
# >> ├─
|
118
|
-
# >> │ ├─
|
119
|
-
# >> │ │ ├─
|
120
|
-
# >> │ │ └─
|
121
|
-
# >> │ └─
|
122
|
-
# >> └─
|
123
|
-
# >> ├─
|
124
|
-
# >> └─
|
125
|
-
# >> ├─
|
126
|
-
# >> └─
|
108
|
+
# >> 70308246324740
|
109
|
+
# >> ├─70308246324580
|
110
|
+
# >> │ ├─70308246324440
|
111
|
+
# >> │ │ ├─70308246324300
|
112
|
+
# >> │ │ ├─70308246324200
|
113
|
+
# >> │ │ │ ├─70308246324060
|
114
|
+
# >> │ │ │ └─70308246323960
|
115
|
+
# >> │ │ └─70308246323860
|
116
|
+
# >> │ └─70308246323760
|
117
|
+
# >> ├─70308246323660
|
118
|
+
# >> │ ├─70308246323520
|
119
|
+
# >> │ │ ├─70308246323380
|
120
|
+
# >> │ │ └─70308246323280
|
121
|
+
# >> │ └─70308246314940
|
122
|
+
# >> └─70308246314840
|
123
|
+
# >> ├─70308246314700
|
124
|
+
# >> └─70308246314600
|
125
|
+
# >> ├─70308246314460
|
126
|
+
# >> └─70308246314360
|
data/lib/tree_support/node.rb
CHANGED
@@ -70,11 +70,16 @@ module TreeSupport
|
|
70
70
|
# {key: :c, parent: :b},
|
71
71
|
# ]
|
72
72
|
#
|
73
|
-
# puts TreeSupport.records_to_tree(records).to_s_tree
|
74
|
-
#
|
75
|
-
# └─
|
76
|
-
#
|
77
|
-
#
|
73
|
+
# puts TreeSupport.records_to_tree(records, root_key: :root).to_s_tree
|
74
|
+
# >> root
|
75
|
+
# >> └─a
|
76
|
+
# >> ├─b
|
77
|
+
# >> ├─c
|
78
|
+
#
|
79
|
+
# puts TreeSupport.records_to_tree(records).first.to_s_tree
|
80
|
+
# >> a
|
81
|
+
# >> ├─b
|
82
|
+
# >> ├─c
|
78
83
|
#
|
79
84
|
# Be sure to have one route
|
80
85
|
#
|
data/lib/tree_support/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tree_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akicho8
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|