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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f3c159380e2736313f949cc4b81ef4a5c0c05672cd080a10a485a257fa99b3a
4
- data.tar.gz: 635c9ae50196b3c727135a96c93352ee7da56a811a0ad285f835701aec341f03
3
+ metadata.gz: 0b7c4cae251c42b16ff5bdc9224f36ac1a61c066949252f7f9d285f6494e65f7
4
+ data.tar.gz: 92d1b69634eb58fecab5e34952526d17bffb8146c31e8b7ca49bb01544c64fde
5
5
  SHA512:
6
- metadata.gz: a8352490bcc6c1e52560b63d81aa7e16404ef55056e48ea4823b4e60b3a6bf22646a1e69b26d1e388279ca28b33d2af8184f8af4fd9200879ff36629f12e2e67
7
- data.tar.gz: 67ee2997beecb2b5f2968fdcd5e1533559581f6f6c544061be916df82d05c5b9eb2ee4844af2d6d6c45ad1dc81dbe5ea3af3782900711112ff11145f3dae51cd
6
+ metadata.gz: abf3a7743b24d80621b3d06759dfa06088880c818aa29e1cde67749d633a8848049244aa146877db31a118ee837acf64f6bbe7cc48e115599d4d143bdf684bfd
7
+ data.tar.gz: 5677cbc0098ad3707eb047d12750e6e0dd3948ae6ffde2812f61a081594aa2647a415c514ecdfac974bb91388c31c3a57e02b571fca6048b4ce0c268ca8d3bb4
data/.gitignore CHANGED
@@ -6,3 +6,5 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+
10
+ *.gem
@@ -1,3 +1,3 @@
1
1
  module FamilyTree
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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-23 00:00:00.000000000 Z
11
+ date: 2022-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tree_graph