modular_tree 0.13.0 → 0.14.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: 2cd6d39620d1c665267716d2089f1c498a1d0dd4aef5fc4b2cba175590d483a8
4
- data.tar.gz: 9f6f684e5433a04541761abb0a6379e18093c77fb2e3cd257ae7bba49ada19c1
3
+ metadata.gz: 3cc95c80ae30705572e57ca0fa6474a0c110e1a58c16425beaa7bffd4fba63b2
4
+ data.tar.gz: 3ca2f7cf282b15630bbcce94d1f9aaa5c95f2bb6d61fe1c14ff8bfd459cc002a
5
5
  SHA512:
6
- metadata.gz: 72e405f8c4e5dcf4111c964301b482743d2ccec4b644c196fc64f15fe5393f713eb7f2e675f6c6f48a694764b4b055196e18a1a53145bfb6e9af920a6991325a
7
- data.tar.gz: 01da8646f20a98c4b4dc85ed7f79e67842a0c5f3836a28a6b1e171f723c861d154ba250bb70243027404daf108f61e09a07a4d2fbf800fcd4a3a3beb9c1d5bee
6
+ metadata.gz: 7e8bf255d379d9b9dd92062de11625602f1462f300187c71042528217cd189b4beb007da047d28c2515ae52dbaaa54e84a02edbde425f5f218439a5ecb317692
7
+ data.tar.gz: 03b60dcc1a77c055ac9456f7c091475ce10a3aece62a1b2adcc09787773676bbf898ff6ec7164bac8c3db3ca9d2be7e6b9456b800e0ea3e66005b17bfe1641e7
@@ -4,8 +4,11 @@ module Tree
4
4
  # Pool adds a @pool class variable to the including class and all of its
5
5
  # subclasses
6
6
  #
7
+ # TODO: Make a separate gem. Then extend with with a lookup method and
8
+ # optionally an specialized #dot method
9
+ #
7
10
  module Pool
8
- include PathAlgorithms
11
+ # include PathAlgorithms
9
12
 
10
13
  def self.included(other)
11
14
  other.extend(ClassMethods)
@@ -15,7 +18,7 @@ module Tree
15
18
 
16
19
  def initialize(*args)
17
20
  super
18
- !self.class.uid?(self.uid) or raise TreeError, "Duplicate UID: #{self.uid}"
21
+ !self.class.uid?(self.uid) or raise TreeError, "Duplicate UID: #{self.uid.inspect}"
19
22
  self.class.send(:[]=, self.uid, self)
20
23
  end
21
24
 
@@ -25,6 +28,7 @@ module Tree
25
28
  def nodes = @pool.values
26
29
  def size = @pool.size
27
30
  def empty? = @pool.empty?
31
+ def empty! = @pool.clear # Useful in tests where a tree is created multiple times
28
32
  def [](uid) = @pool[uid]
29
33
  def []=(uid, node) @pool[uid] = node end
30
34
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tree
4
- VERSION = "0.13.0"
4
+ VERSION = "0.14.1"
5
5
  end
data/lib/modular_tree.rb CHANGED
@@ -115,7 +115,6 @@ module Tree
115
115
  # data.visit { ... }
116
116
  #
117
117
 
118
-
119
118
  # p Tree.ancestors
120
119
  # exit
121
120
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modular_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Rasmussen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-10 00:00:00.000000000 Z
11
+ date: 2023-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: constrain