motion_coercible 0.2.0.1 → 0.2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWI5NzdjNmUxZGVjMzA4NmNhOWUzZWNiNGY2MTRkNTZiOTYzNDNiZg==
4
+ NzkwMmIzMzkxMzdlODQxOGNkNjA1OTkzYjA4MzkyMmE0YjM3NmVjMg==
5
5
  data.tar.gz: !binary |-
6
- Y2NlMWY0NjRhYmVjYzhiYzFlYjU5NmIzMGI2MjA3ZjI0Y2QwYmFlNw==
6
+ MjQ3OGVmYWNjOWNhODFlNjAzZjVmOWM5NTA3YTcwYzllMGQwNzYwZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MWM3MWM4N2M2ZGIxYTE0YmVhZjUzYTJjM2JkMTlhYjgzZDVmODNkYzYzNDkw
10
- MDY0ZDY1NWJlOGNiZGRjMTQ0ZTBhMmMxZThjYjc0MmQxNzY4ZDQ1NGJiMjhi
11
- ZjE0ZmFiYjM5ZWJmZDgxMzVhNDA0OTQ5OGU4ZWRkZmQ3MDdkOGE=
9
+ MjhlYWUwMDliNDhmMTY0ZDM5ZmM5YzhlOTBhMzJlNzRkYjEyZTg4ZTQ4ZTU2
10
+ NTNmZjZmNWM3MzI5NWMzZmEwZTI0NTZjN2M5YTE2ZjhjM2I5NjIwMmQ4NjRl
11
+ NWNhYjFhYmQ2NzAwYzQ4NjdjMzEzZmE5NjkwNmI1MjI2ZTFlOTc=
12
12
  data.tar.gz: !binary |-
13
- M2I4OWE4ZDk0OTU2NzQwMTBiNjZjZmIxMDNiOWRiZGE5YjA5MzVmZjc0NDE0
14
- NTNjNjQxZmExZGNiNjllOWFiNzMzM2VjZjUzYjE5ZTc4ZWE1ZDcwMDg2OGMz
15
- NGY5OTE2ZjJlM2Q0OTBhMDk0YTI2NDEwYWMyY2E4N2I3YzliYjA=
13
+ ZjA3ODIxYmI2YTBmNmFmYzQxMWM3OTIxODBjZDA2N2YxNmQ5YjUxNTg2M2E5
14
+ MmVjN2I3NDEzMGNhM2M3Y2RiM2ZmMjRkZjQ5ZGMwZjM0ZmYyNDViYjE0NGYx
15
+ MDcwZWE3ZTIyNTE0NjZmMWMzNjQyNzhjZWJhMGU5ZWE0NmIzNTk=
@@ -2,8 +2,6 @@ unless defined?(Motion::Project::Config)
2
2
  raise "This file must be required within a RubyMotion project Rakefile."
3
3
  end
4
4
 
5
- require 'motion_descendants_tracker'
6
-
7
5
  require 'motion-require'
8
6
  Motion::Require.all(Dir.glob(File.expand_path('../project/**/*.rb', __FILE__)))
9
7
 
@@ -1,4 +1,5 @@
1
1
  motion_require 'stubs.rb'
2
+ motion_require 'support/descendants_tracker'
2
3
  motion_require 'support/type_lookup'
3
4
  motion_require 'support/options'
4
5
 
@@ -0,0 +1,48 @@
1
+ # encoding: utf-8
2
+
3
+ module Coercible
4
+ # Module that adds descendant tracking to a class
5
+ module DescendantsTracker
6
+
7
+ # Return the descendants of this class
8
+ #
9
+ # @example
10
+ # descendants = ParentClass.descendants
11
+ #
12
+ # @return [Array<Class>]
13
+ #
14
+ # @api public
15
+ def descendants
16
+ @descendants ||= []
17
+ end
18
+
19
+ # Add the descendant to this class and the superclass
20
+ #
21
+ # @param [Class] descendant
22
+ #
23
+ # @return [self]
24
+ #
25
+ # @api private
26
+ def add_descendant(descendant)
27
+ ancestor = superclass
28
+ ancestor.add_descendant(descendant) if ancestor.respond_to?(:add_descendant)
29
+ descendants.unshift(descendant)
30
+ self
31
+ end
32
+
33
+ private
34
+
35
+ # Hook called when class is inherited
36
+ #
37
+ # @param [Class] descendant
38
+ #
39
+ # @return [self]
40
+ #
41
+ # @api private
42
+ def inherited(descendant)
43
+ super
44
+ add_descendant(descendant)
45
+ end
46
+
47
+ end # module DescendantsTracker
48
+ end
@@ -1,3 +1,3 @@
1
1
  module Coercible
2
- VERSION = "0.2.0.1"
2
+ VERSION = "0.2.0.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: motion_coercible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.1
4
+ version: 0.2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Closner
@@ -70,6 +70,7 @@ files:
70
70
  - lib/project/stubs/date_time.rb
71
71
  - lib/project/stubs/decimal.rb
72
72
  - lib/project/stubs.rb
73
+ - lib/project/support/descendants_tracker.rb
73
74
  - lib/project/support/options.rb
74
75
  - lib/project/support/type_lookup.rb
75
76
  - lib/project/version.rb