dsl_compose 1.14.3 → 2.0.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: 66f81fd1f2837e1117bbf857e0c82d4b778bc1c994b6fcef6822f7d4bbc8a67c
4
- data.tar.gz: 35418838094f4d67161f1c105fd3f377ac3dec99165c2a2330f55211b618c6d6
3
+ metadata.gz: ca7d4076508adb7aa4c534ffe69f276d4da8c50abcb65dbc898a2a40a241b2be
4
+ data.tar.gz: f0efae218b8a5ed32212077de0b42d3a345e5578c29ebf0dc4e00356ae0d00cf
5
5
  SHA512:
6
- metadata.gz: 4e28260ad137a173ccea457daf2a2d6c242da73483e5843a4562b376acaa24d833f0258057be4923a6eba5578b1dd1c0c3b26a90fa0cf90b919f6912baac17fe
7
- data.tar.gz: 91b1547ad26635ef8dc968a2a18a939f28344c3bf164f50992033724f3b73882628f928b5c14c4b27411bfba60c9abb9627170244e4ffda3f477da3e3f59cd0c
6
+ metadata.gz: 1f1302ffba75b9614fbecf1c3d84159360dcbc67f760e7474fed1e9ba321abeb7200c424ba0b9c6d7a6eb26891649012474037a896387eeec058fc3e58cba651
7
+ data.tar.gz: b20711b1f065090f9507e32029640d3766f8fd4ceb0a5d1d9372c3ddbdb03eef311982531284d0b213b4a559d614929f3531747b659db88d5eda8ebffd22cc6c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.1](https://github.com/craigulliott/dsl_compose/compare/v2.0.0...v2.0.1) (2023-07-19)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * ensuring the class is still defined and at the global Object scope, this prevents recently deleted classes from showing up before they have been garbage collected ([#51](https://github.com/craigulliott/dsl_compose/issues/51)) ([52111e3](https://github.com/craigulliott/dsl_compose/commit/52111e3647e8f9d26dcbea706dbe6977bf67c426))
9
+
10
+ ## [2.0.0](https://github.com/craigulliott/dsl_compose/compare/v1.14.4...v2.0.0) (2023-07-19)
11
+
12
+
13
+ ### ⚠ BREAKING CHANGES
14
+
15
+ * 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))
16
+
17
+ ### Bug Fixes
18
+
19
+ * 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))
20
+
3
21
  ## [1.14.3](https://github.com/craigulliott/dsl_compose/compare/v1.14.2...v1.14.3) (2023-07-19)
4
22
 
5
23
 
@@ -11,7 +11,7 @@ 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
17
  # by the presence of decendents and finally by their name
@@ -32,8 +32,19 @@ 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.filter { |subclass| class_is_still_defined? subclass }.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 { |subclass| class_is_still_defined? subclass } > 0
44
+ end
45
+
46
+ def class_is_still_defined? klass
47
+ Object.const_defined?(klass.name) && Object.const_get(klass.name).equal?(klass)
37
48
  end
38
49
  end
39
50
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DSLCompose
4
- VERSION = "1.14.3"
4
+ VERSION = "2.0.1"
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.3
4
+ version: 2.0.1
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