motion-objection 0.6.2 → 0.6.3
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
|
-
|
4
|
+
YmY1MDA5MTVkNjJkY2UyNGU4MDY2YTZmNmRmNzEzZDYxYTRiNzgzMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2IzYWZmNjBjODkxNGMxYzg1MjFjZTM2ZmE0MTNmZDBiMWRlY2E3MQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzZkZjM0YmQyOTc3OTM1OWJkMDIyODg4YjJmZTczMWIwNTg4YTJhNGEwMGU1
|
10
|
+
YmJkNDkzYjdlYmVlY2EzZWFjN2E5ZGJmY2QwZGIxZjFkOGFlMmUwNzBhZGQy
|
11
|
+
OTAyYzgzYTU4MTM1ODIyZDljODU3MTQwMDgxOGYyNzFkZWJhZjI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjRjYzI3MTA5YjkzYjliZmMyZjkyMTVhM2ViMmU2OTg1YmE0MTAzZWMwODg4
|
14
|
+
NDBlZTg3OTA1NWE2NWRlNWI5YWM5YTgwNDczNDg4MmE5OTQ3NDNlZDNjZjU1
|
15
|
+
MzU0ZDAwOTQ3ZDIyMzc4MzhkNzQyZTg5Njk3NWQ2MDFkNWYzMGY=
|
data/README.md
CHANGED
@@ -5,6 +5,7 @@ Wrapping the dependency injection library [Objection](https://github.com/atomico
|
|
5
5
|
|
6
6
|
[](https://travis-ci.org/atomicobject/motion-objection)
|
7
7
|
[](http://badge.fury.io/rb/motion-objection)
|
8
|
+
[](https://codeclimate.com/github/atomicobject/motion-objection)
|
8
9
|
|
9
10
|
## Install
|
10
11
|
```bash
|
@@ -15,7 +16,7 @@ gem install motion-objection
|
|
15
16
|
```ruby
|
16
17
|
class Car
|
17
18
|
include Objection
|
18
|
-
compose_with :engine, :brakes
|
19
|
+
compose_with :engine, :brakes, factory: JSObjectFactory
|
19
20
|
end
|
20
21
|
|
21
22
|
class Engine
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Objection
|
2
|
+
module Inflector
|
3
|
+
NAMESPACE_SEPARTOR = "/"
|
4
|
+
|
5
|
+
def self.included(base)
|
6
|
+
base.send :include, InstanceMethods
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.constantize(string)
|
10
|
+
scopes = string.split(NAMESPACE_SEPARTOR).map { |x| x.split("_") }.map { |x| x.map { |y| y.capitalize }.join("") }
|
11
|
+
scopes.inject(Object) do |const, name|
|
12
|
+
const.const_get name
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module InstanceMethods
|
17
|
+
def objection_constantize
|
18
|
+
Inflector.constantize(self)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,16 +1,11 @@
|
|
1
1
|
class RubyPropertyReflector
|
2
|
-
NAMESPACE_SEPARTOR = "/"
|
3
2
|
|
4
3
|
def self.propertyForClass(klass, andProperty: property)
|
5
|
-
|
6
|
-
|
7
|
-
dependency_type =
|
8
|
-
else
|
9
|
-
scopes = klass.send(:objectionTypeMappings)[property].to_s.split(NAMESPACE_SEPARTOR).map { |x| x.split("_") }.map { |x| x.map { |y| y.capitalize }.join("") }
|
10
|
-
dependency_type = scopes.inject(Object) do |const, name|
|
11
|
-
const.const_get name
|
12
|
-
end
|
4
|
+
dependency_type = klass.send(:objectionTypeMappings)[property]
|
5
|
+
unless dependency_type.is_a? Class
|
6
|
+
dependency_type = dependency_type.objection_constantize
|
13
7
|
end
|
14
8
|
JSObjectionPropertyInfo.new(dependency_type, JSObjectionTypeClass).value
|
15
9
|
end
|
10
|
+
|
16
11
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-objection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin DeWind
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: motion-cocoapods
|
@@ -40,10 +40,12 @@ files:
|
|
40
40
|
- Rakefile
|
41
41
|
- app/app_delegate.rb
|
42
42
|
- lib/motion-objection.rb
|
43
|
+
- lib/motion-objection/inflector.rb
|
43
44
|
- lib/motion-objection/jsobjection.rb
|
44
45
|
- lib/motion-objection/jsobjection_injector.rb
|
45
46
|
- lib/motion-objection/objection.rb
|
46
47
|
- lib/motion-objection/ruby_property_reflector.rb
|
48
|
+
- lib/motion-objection/string.rb
|
47
49
|
- lib/motion-objection/version.rb
|
48
50
|
- motion_objection.gemspec
|
49
51
|
- resources/Default-568h@2x.png
|