motion_descendants_tracker 0.0.2.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 +15 -0
- data/README.md +38 -0
- data/lib/motion_descendants_tracker.rb +10 -0
- data/lib/project/descendants_tracker.rb +46 -0
- data/lib/project/version.rb +8 -0
- metadata +76 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZTA1OGI4MjcwZmIzMTg4YjU3YWNmZTBjZWQ3NTE0NTk3MDRlMGE1Mg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MDBiMzFiODBiOTA3ZDA3NDViY2VhY2M0OGYxNTcwYjk4NzcwOTMzMQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjJmYTI1M2U0MzlkNjE1ZWRhZmJlZGRlMmJiZThiZjljMzk2ZGM5MmE2Y2Q0
|
10
|
+
YzZlODY0MTBmYWZmMGY0ZDkyMWZkOTI5NDYwODRjY2NjYWI0Y2VlYTU0ZTBm
|
11
|
+
MTViOGQ3ODVlYzM0OGU5NTU0YWI3MmViZDBjNDlhMGFhMWFiMDk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OTJmZjQwNzAwNjRjYzBkYzJlNzRkOWUxMjY3MWM3ZWYxYTdjNmYyYTNmYjU0
|
14
|
+
MGZkZjFlNjVkMmVlM2FiMDUwZTY1MWRjNGY4NGYyYzZiNTIzMGMwYTdkMWVm
|
15
|
+
MDU3NjdjOWQ2MjRiYjQwZWFlNDFmZTgwNDQwMjY2NjczZDE2ODY=
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# motion_descendants_tracker
|
2
|
+
|
3
|
+
A RubyMotion port of [dkubb's](https://github.com/dkubb) [descendants_tracker](https://github.com/dkubb/descendants_tracker) library.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'motion_descendants_tracker'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install motion_descendants_tracker
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
``` ruby
|
22
|
+
class Foo
|
23
|
+
extend DescendantsTracker
|
24
|
+
end
|
25
|
+
|
26
|
+
class Bar < Foo
|
27
|
+
end
|
28
|
+
|
29
|
+
Foo.descendants # => [Bar]
|
30
|
+
```
|
31
|
+
|
32
|
+
## Contributing
|
33
|
+
|
34
|
+
1. Fork it
|
35
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
36
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
37
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
38
|
+
5. Create new Pull Request
|
@@ -0,0 +1,10 @@
|
|
1
|
+
unless defined?(Motion::Project::Config)
|
2
|
+
raise "This file must be required within a RubyMotion project Rakefile."
|
3
|
+
end
|
4
|
+
|
5
|
+
require "motion-require"
|
6
|
+
Motion::Require.all(Dir.glob(File.expand_path("../project/**/*.rb", __FILE__)))
|
7
|
+
|
8
|
+
Motion::Project::App.setup do |app|
|
9
|
+
# configuration
|
10
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Module that adds descendant tracking to a class
|
4
|
+
module DescendantsTracker
|
5
|
+
|
6
|
+
# Return the descendants of this class
|
7
|
+
#
|
8
|
+
# @example
|
9
|
+
# descendants = ParentClass.descendants
|
10
|
+
#
|
11
|
+
# @return [Array<Class>]
|
12
|
+
#
|
13
|
+
# @api public
|
14
|
+
def descendants
|
15
|
+
@descendants ||= []
|
16
|
+
end
|
17
|
+
|
18
|
+
# Add the descendant to this class and the superclass
|
19
|
+
#
|
20
|
+
# @param [Class] descendant
|
21
|
+
#
|
22
|
+
# @return [self]
|
23
|
+
#
|
24
|
+
# @api private
|
25
|
+
def add_descendant(descendant)
|
26
|
+
ancestor = superclass
|
27
|
+
ancestor.add_descendant(descendant) if ancestor.respond_to?(:add_descendant)
|
28
|
+
descendants.unshift(descendant)
|
29
|
+
self
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
# Hook called when class is inherited
|
35
|
+
#
|
36
|
+
# @param [Class] descendant
|
37
|
+
#
|
38
|
+
# @return [self]
|
39
|
+
#
|
40
|
+
# @api private
|
41
|
+
def inherited(descendant)
|
42
|
+
super
|
43
|
+
add_descendant(descendant)
|
44
|
+
end
|
45
|
+
|
46
|
+
end # module DescendantsTracker
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: motion_descendants_tracker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan Closner
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: motion-require
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: A RubyMotion port of descendants_tracker
|
42
|
+
email:
|
43
|
+
- ryan@ryanclosner.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- README.md
|
49
|
+
- lib/motion_descendants_tracker.rb
|
50
|
+
- lib/project/descendants_tracker.rb
|
51
|
+
- lib/project/version.rb
|
52
|
+
homepage: http://github.com/rclosner/motion_descendants_tracker
|
53
|
+
licenses: []
|
54
|
+
metadata: {}
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
requirements: []
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 2.0.6
|
72
|
+
signing_key:
|
73
|
+
specification_version: 4
|
74
|
+
summary: A RubyMotion port of descendants_tracker
|
75
|
+
test_files: []
|
76
|
+
has_rdoc:
|