dry-core 0.4.2 → 0.4.3

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
- SHA1:
3
- metadata.gz: 1bb0fe21e198b946d0363a8a082f3c860605eb38
4
- data.tar.gz: d08019514eabec7e537e2a01138378295a62a75e
2
+ SHA256:
3
+ metadata.gz: 7b5db0cab5b5197fea7cda5ea4ed1e5fcdeaca63bcb736775c2f90c8bf5b4967
4
+ data.tar.gz: d056e9fe44d76a4116afda3df87164abdab03d9cbf31d5b3abad52f4c2ef7724
5
5
  SHA512:
6
- metadata.gz: 68b16b0ce816c94c9187d3721933aad533d5d8450c742b5e3659cdfc5dc77d6a63d3ae56f67c2278a3403382bace6af3396aefcb77f5f2a06053d3c16efb1d94
7
- data.tar.gz: 5d97a6f64702926e66aba7bf4d1727f143997cce3054d4c58f35890a4e344265e4f37492f6cc56aec80685bdefce9a4fd6a1bc8e3c802fbec6feaad76e99d90a
6
+ metadata.gz: 02c968169fb2112878c74307fffb53e224370ab891f1722c3af2c3eef0cf08f76578e0ef4cf5ee51c12bba13b735d5b65c08b5160044d6104da40e80a844653c
7
+ data.tar.gz: ca68db57997380c256d35f0bd74a2a9fbfb503b177c49a9061d903402e1d4a794c0936a8b2b8e65272f7f069b03e1e88f8199faf17340855b25f98008b0040cd
data/.travis.yml CHANGED
@@ -7,12 +7,16 @@ after_success:
7
7
  - '[ -d coverage ] && bundle exec codeclimate-test-reporter'
8
8
  script:
9
9
  - bundle exec rake
10
+ before_install:
11
+ - gem update --system
12
+ after_success:
13
+ - '[ -d coverage ] && bundle exec codeclimate-test-reporter'
10
14
  rvm:
11
- - 2.1.10
12
- - 2.2.7
13
- - 2.3.4
14
- - 2.4.1
15
- - jruby-9.1.9.0
15
+ - 2.2.9
16
+ - 2.3.6
17
+ - 2.4.3
18
+ - 2.5.0
19
+ - jruby-9.1.15.0
16
20
  env:
17
21
  global:
18
22
  - COVERAGE=true
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # v0.4.3 2018-02-03
2
+
3
+ ### Added
4
+
5
+ * `Dry::Core::DescendantsTracker` which is a maintained version of the [`descendants_tracker`](https://github.com/dkubb/descendants_tracker) gem (flash-gordon)
6
+
7
+ [Compare v0.4.2...v0.4.3](https://github.com/dry-rb/dry-core/compare/v0.4.2...0.4.3)
8
+
1
9
  # v0.4.2 2017-12-16
2
10
 
3
11
  ### Fixed
@@ -0,0 +1,76 @@
1
+ require 'concurrent/array'
2
+
3
+ module Dry
4
+ module Core
5
+ # An implementation of descendants tracker, heavily inspired
6
+ # by the descendants_tracker gem.
7
+ #
8
+ # @example
9
+ #
10
+ # class Base
11
+ # extend Dry::Core::DescendantsTracker
12
+ # end
13
+ #
14
+ # class A < Base
15
+ # end
16
+ #
17
+ # class B < Base
18
+ # end
19
+ #
20
+ # class C < A
21
+ # end
22
+ #
23
+ # Base.descendants # => [C, B, A]
24
+ # A.descendants # => [C]
25
+ # B.descendants # => []
26
+ #
27
+ module DescendantsTracker
28
+ class << self
29
+ # @api private
30
+ def setup(target)
31
+ target.instance_variable_set(:@descendants, Concurrent::Array.new)
32
+ end
33
+
34
+ private
35
+
36
+ # @api private
37
+ def extended(base)
38
+ super
39
+
40
+ DescendantsTracker.setup(base)
41
+ end
42
+ end
43
+
44
+ # Return the descendants of this class
45
+ #
46
+ # @example
47
+ # descendants = Parent.descendants
48
+ #
49
+ # @return [Array<Class>]
50
+ #
51
+ # @api public
52
+ attr_reader :descendants
53
+
54
+ protected
55
+
56
+ # @api private
57
+ def add_descendant(descendant)
58
+ ancestor = superclass
59
+ if ancestor.respond_to?(:add_descendant, true)
60
+ ancestor.add_descendant(descendant)
61
+ end
62
+ descendants.unshift(descendant)
63
+ end
64
+
65
+ private
66
+
67
+ # @api private
68
+ def inherited(descendant)
69
+ super
70
+
71
+ DescendantsTracker.setup(descendant)
72
+ add_descendant(descendant)
73
+ end
74
+ end
75
+ end
76
+ end
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Core
3
- VERSION = '0.4.2'.freeze
3
+ VERSION = '0.4.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikita Shilnikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-16 00:00:00.000000000 Z
11
+ date: 2018-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -92,6 +92,7 @@ files:
92
92
  - lib/dry/core/class_builder.rb
93
93
  - lib/dry/core/constants.rb
94
94
  - lib/dry/core/deprecations.rb
95
+ - lib/dry/core/descendants_tracker.rb
95
96
  - lib/dry/core/errors.rb
96
97
  - lib/dry/core/extensions.rb
97
98
  - lib/dry/core/inflector.rb
@@ -117,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  version: '0'
118
119
  requirements: []
119
120
  rubyforge_project:
120
- rubygems_version: 2.6.14
121
+ rubygems_version: 2.7.3
121
122
  signing_key:
122
123
  specification_version: 4
123
124
  summary: A toolset of small support modules used throughout the dry-rb ecosystem.