motion_coercible 0.2.0.1 → 0.2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/motion_coercible.rb +0 -2
- data/lib/project/coercible.rb +1 -0
- data/lib/project/support/descendants_tracker.rb +48 -0
- data/lib/project/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzkwMmIzMzkxMzdlODQxOGNkNjA1OTkzYjA4MzkyMmE0YjM3NmVjMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjQ3OGVmYWNjOWNhODFlNjAzZjVmOWM5NTA3YTcwYzllMGQwNzYwZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjhlYWUwMDliNDhmMTY0ZDM5ZmM5YzhlOTBhMzJlNzRkYjEyZTg4ZTQ4ZTU2
|
10
|
+
NTNmZjZmNWM3MzI5NWMzZmEwZTI0NTZjN2M5YTE2ZjhjM2I5NjIwMmQ4NjRl
|
11
|
+
NWNhYjFhYmQ2NzAwYzQ4NjdjMzEzZmE5NjkwNmI1MjI2ZTFlOTc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjA3ODIxYmI2YTBmNmFmYzQxMWM3OTIxODBjZDA2N2YxNmQ5YjUxNTg2M2E5
|
14
|
+
MmVjN2I3NDEzMGNhM2M3Y2RiM2ZmMjRkZjQ5ZGMwZjM0ZmYyNDViYjE0NGYx
|
15
|
+
MDcwZWE3ZTIyNTE0NjZmMWMzNjQyNzhjZWJhMGU5ZWE0NmIzNTk=
|
data/lib/motion_coercible.rb
CHANGED
@@ -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
|
|
data/lib/project/coercible.rb
CHANGED
@@ -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
|
data/lib/project/version.rb
CHANGED
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.
|
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
|