family_tree 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/lib/family_tree/version.rb +1 -1
- data/lib/family_tree.rb +8 -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: 0b7c4cae251c42b16ff5bdc9224f36ac1a61c066949252f7f9d285f6494e65f7
|
4
|
+
data.tar.gz: 92d1b69634eb58fecab5e34952526d17bffb8146c31e8b7ca49bb01544c64fde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abf3a7743b24d80621b3d06759dfa06088880c818aa29e1cde67749d633a8848049244aa146877db31a118ee837acf64f6bbe7cc48e115599d4d143bdf684bfd
|
7
|
+
data.tar.gz: 5677cbc0098ad3707eb047d12750e6e0dd3948ae6ffde2812f61a081594aa2647a415c514ecdfac974bb91388c31c3a57e02b571fca6048b4ce0c268ca8d3bb4
|
data/lib/family_tree/version.rb
CHANGED
data/lib/family_tree.rb
CHANGED
@@ -8,12 +8,15 @@ module FamilyTree
|
|
8
8
|
attr_reader :klass, :descendants
|
9
9
|
|
10
10
|
alias_method :label_for_tree_graph, :klass
|
11
|
-
alias_method :children_for_tree_graph, :descendants
|
12
11
|
|
13
12
|
def initialize(klass)
|
14
13
|
@klass = klass
|
15
14
|
@descendants = []
|
16
15
|
end
|
16
|
+
|
17
|
+
def children_for_tree_graph
|
18
|
+
descendants.sort_by{ |d| d.klass.name }
|
19
|
+
end
|
17
20
|
end
|
18
21
|
|
19
22
|
class << self
|
@@ -23,6 +26,10 @@ module FamilyTree
|
|
23
26
|
Array(klasses).each do |k|
|
24
27
|
parent = root
|
25
28
|
|
29
|
+
if String === k
|
30
|
+
k = k.split('::').reduce(::Object){ |namespace, name| namespace.const_get(name) }
|
31
|
+
end
|
32
|
+
|
26
33
|
k.ancestors.reverse_each do |a|
|
27
34
|
next unless Class === a
|
28
35
|
next if ::BasicObject == a
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: family_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ken
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
11
|
+
date: 2022-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tree_graph
|