motion-objection 0.6 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +11 -1
- data/lib/motion-objection/jsobjection_injector.rb +12 -1
- data/lib/motion-objection/version.rb +1 -1
- data/spec/objection_spec.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDllZmQ5MjJhM2QyMWRiMWYzZjgwMjdjNWQ1M2FlN2IyMWViYmExZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Mzc0ZDdkNDYxNzMxYWFjMjRlYzM3OTJmNTYzZjNjYjRlMWYwY2E0ZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NDA4YzMxYTUwMGY4Mjk5NzZmNjQzYmNhMGFlOTlmMjc1MGNlYzhlZjg2ODQ0
|
10
|
+
NDExNWJmNGQzNWRkZmU3ZDlmY2Y1NjUxNjk2N2UwYmNkMzA3NDM0NzMwOTQ2
|
11
|
+
ZTY5YjAzZGVhOTMwMjRlNGVmODc2NTMwZDg0ZjQxOTI0NzUyZWI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzFhNTkyOWRmOTY3NjYzYmM5NDk2NmNhZGUyYzBiNjdlMTA3ZWQyN2NjZTY3
|
14
|
+
NzdiNGM4M2IwYTNkOTYwNDdiY2I4MjBkNzgxZmVjNzhkMjU1NWViMTUzNTE3
|
15
|
+
M2Y5ZjczMzM4YWQ2YTQ4NTFiNTM5Nzg2MWUwY2RkMDI4MGEzYTU=
|
data/README.md
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
motion-objection
|
2
2
|
================
|
3
3
|
|
4
|
-
Wrapping Objection in RubyMotion.
|
4
|
+
Wrapping the dependency injection library [Objection](https://github.com/atomicobject/objection) in RubyMotion.
|
5
5
|
|
6
6
|
[![Build Status](https://travis-ci.org/atomicobject/motion-objection.png)](https://travis-ci.org/atomicobject/motion-objection)
|
7
7
|
|
8
|
+
## Install
|
9
|
+
```bash
|
10
|
+
gem install motion-objection
|
11
|
+
```
|
8
12
|
## Basic Example
|
9
13
|
|
10
14
|
```ruby
|
@@ -52,3 +56,9 @@ class ViewController < NSObject
|
|
52
56
|
end
|
53
57
|
end
|
54
58
|
```
|
59
|
+
|
60
|
+
## Default Injector
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
Objection.default_injector = Objection.injector
|
64
|
+
```
|
@@ -1,11 +1,22 @@
|
|
1
1
|
class JSObjectionInjector
|
2
2
|
alias_method :[], :getObject
|
3
|
+
alias_method :inject_dependencies, :injectDependencies
|
4
|
+
alias_method :with_module, :withModule
|
5
|
+
alias_method :without_module_of_type, :withoutModuleOfType
|
3
6
|
|
4
7
|
def get_object(klass, *args)
|
5
8
|
if args.empty?
|
6
9
|
getObject klass
|
7
10
|
else
|
8
|
-
|
11
|
+
getObject klass, argumentList: args
|
9
12
|
end
|
10
13
|
end
|
14
|
+
|
15
|
+
def with_modules(*modules)
|
16
|
+
withModuleCollection modules
|
17
|
+
end
|
18
|
+
|
19
|
+
def without_modules_of_type(*modules)
|
20
|
+
withoutModuleCollection modules
|
21
|
+
end
|
11
22
|
end
|
data/spec/objection_spec.rb
CHANGED
@@ -72,5 +72,10 @@ describe "Objection" do
|
|
72
72
|
@controller = @injector[ViewController]
|
73
73
|
@controller.name.should.equal "Home"
|
74
74
|
end
|
75
|
+
|
76
|
+
it "has support for getting an object with custom arguments" do
|
77
|
+
@controller = @injector.get_object ViewController, "Work"
|
78
|
+
@controller.name.should.equal "Work"
|
79
|
+
end
|
75
80
|
end
|
76
81
|
end
|