dsl_compose 1.14.2 → 2.0.0

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: 623399acb76c51f12e07ed2ac76358334298cd9714a222ad271a3c90b1cc2aa2
4
- data.tar.gz: 42069e337ec7435aea513ffd42f7303d62d62900f84de3e9822129e895fb3e92
3
+ metadata.gz: c500aadb33dba86d32443e6e438949e9e6d72d86133b2b1f97efbe2198ab1a10
4
+ data.tar.gz: 352cd66ca3c3274ff3f442b32e2740d61e976ca3d4e6cf57309dc4adc9558e3d
5
5
  SHA512:
6
- metadata.gz: a68c4971e5ac2057e31df63d28ec097c9f5a0ceaca2dc80d9a5997e50373218831c5aeb3733d9b005b9cb2a849d30065e28b5844e376e2fc8093667cf12cf887
7
- data.tar.gz: '097c77a640d68e46057911d0b75067fd215d251e6fc218982ee8f4d37ff315cb87e3e6f1db1079806d881018ef84a900f1cd17178b04f20616127bb56545750a'
6
+ metadata.gz: 186e700824f1c985420036b24290e9ec682a54a6f81cbd7d5822006c6d3fe2fa4cfc780fc27b5a202475cd335308e09576971db85bff76dced1c419cb406b1a1
7
+ data.tar.gz: 2b5eec77d4a0619aef13218b35e4e64cecd96aa0476eb671f2d9aebb84b6f9d3e199a570beb89437844a4e6c68db8bdd6ef39a7039f30341cf8115ce163129b7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.0](https://github.com/craigulliott/dsl_compose/compare/v1.14.4...v2.0.0) (2023-07-19)
4
+
5
+
6
+ ### ⚠ BREAKING CHANGES
7
+
8
+ * Removing dependency on ObjectSpace because of the problems it creates with garbage collection and test suites which dynamically create and destroy classes. This required bumping the minimum version of ruby to 3.1.4 ([#49](https://github.com/craigulliott/dsl_compose/issues/49))
9
+
10
+ ### Bug Fixes
11
+
12
+ * Removing dependency on ObjectSpace because of the problems it creates with garbage collection and test suites which dynamically create and destroy classes. This required bumping the minimum version of ruby to 3.1.4 ([#49](https://github.com/craigulliott/dsl_compose/issues/49)) ([b63d8cf](https://github.com/craigulliott/dsl_compose/commit/b63d8cf9698dfc161cb910bd86e7f8d71961b9b1))
13
+
14
+ ## [1.14.3](https://github.com/craigulliott/dsl_compose/compare/v1.14.2...v1.14.3) (2023-07-19)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * for_children_of returns classes with dependencies before classes without any dependencies, this fixes a bug where the parser is used to create other classes, and classes with dependencies need to be created first ([#45](https://github.com/craigulliott/dsl_compose/issues/45)) ([ffc481d](https://github.com/craigulliott/dsl_compose/commit/ffc481d8cdcc85483bfc3829ac3eacd3f44ec657))
20
+
3
21
  ## [1.14.2](https://github.com/craigulliott/dsl_compose/compare/v1.14.1...v1.14.2) (2023-07-19)
4
22
 
5
23
 
@@ -11,12 +11,12 @@ module DSLCompose
11
11
 
12
12
  def classes
13
13
  # all objects which extend the provided base class
14
- extending_classes = ObjectSpace.each_object(Class).select { |klass| klass < @base_class }
14
+ extending_classes = subclasses @base_class
15
15
 
16
16
  # sort the results, classes are ordered first by the depth of their namespace, and second
17
- # by their name
17
+ # by the presence of decendents and finally by their name
18
18
  extending_classes.sort_by! do |child_class|
19
- "#{child_class.name.split("::").count}_#{child_class.name}"
19
+ "#{child_class.name.split("::").count}_#{has_descendents(child_class) ? 0 : 1}_#{child_class.name}"
20
20
  end
21
21
 
22
22
  # if this is not a final child, but we are processing final children only, then skip it
@@ -32,8 +32,15 @@ module DSLCompose
32
32
 
33
33
  private
34
34
 
35
+ # recursively get all sub classes of the provided base class
36
+ def subclasses base_class
37
+ base_class.subclasses.map { |subclass|
38
+ [subclass] + subclasses(subclass)
39
+ }.flatten
40
+ end
41
+
35
42
  def has_descendents base_class
36
- ObjectSpace.each_object(Class).count { |klass| klass < base_class } > 0
43
+ base_class.subclasses.count > 0
37
44
  end
38
45
  end
39
46
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DSLCompose
4
- VERSION = "1.14.2"
4
+ VERSION = "2.0.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dsl_compose
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.2
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Craig Ulliott
@@ -90,14 +90,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
91
  - - ">="
92
92
  - !ruby/object:Gem::Version
93
- version: 3.0.0
93
+ version: 3.1.4
94
94
  required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  requirements: []
100
- rubygems_version: 3.2.3
100
+ rubygems_version: 3.3.26
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: Ruby gem to add dynamic DSLs to classes