motion-objection 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZDljYjFhMmUzNTYxMjc3MWU5OTdjNGQ0NTM2MTdmMWZmMDk4NGVhYw==
4
+ YmY1MDA5MTVkNjJkY2UyNGU4MDY2YTZmNmRmNzEzZDYxYTRiNzgzMA==
5
5
  data.tar.gz: !binary |-
6
- MDljMjMwZjBmOGVlMTRlOTUyZGU2NTM5ODY2NjAyMzVkNzVhNGRiZQ==
6
+ N2IzYWZmNjBjODkxNGMxYzg1MjFjZTM2ZmE0MTNmZDBiMWRlY2E3MQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MWQ3ZjdiMGE5NzQxZWZjOWI1MTM1YzFmNmM4MTlkMTEyYWE5YTY3NGQ0ZWQ4
10
- Nzk5NDA5Y2M3YmRlODRiOTNiNjZlZmIwMGE4ODIwMDk5YTlhZDdlNDc0M2Fk
11
- MGQwOWUzNjM5YzJhZmJjOWQyNTFlZmRiMzUxYTVmYTkyNGNhZTU=
9
+ YzZkZjM0YmQyOTc3OTM1OWJkMDIyODg4YjJmZTczMWIwNTg4YTJhNGEwMGU1
10
+ YmJkNDkzYjdlYmVlY2EzZWFjN2E5ZGJmY2QwZGIxZjFkOGFlMmUwNzBhZGQy
11
+ OTAyYzgzYTU4MTM1ODIyZDljODU3MTQwMDgxOGYyNzFkZWJhZjI=
12
12
  data.tar.gz: !binary |-
13
- MWJjZjdiNjcwNzE0MDU1YmFlOGNhYmI0MzAyMGFhZjAyZDJlZmYzZmZmM2My
14
- NzczNjc5NDc1Mzc0ODk5OTU2MzY0MWI0M2NlNDU5MzQ3NGU0ZDAyNzMxN2Jm
15
- YWZkNGE5MTkwYTY4YzdmNzY1NGU4NGU4YzBhMTI4M2RkOTc5ZWY=
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
  [![Build Status](https://travis-ci.org/atomicobject/motion-objection.png)](https://travis-ci.org/atomicobject/motion-objection)
7
7
  [![Gem Version](https://badge.fury.io/rb/motion-objection.png)](http://badge.fury.io/rb/motion-objection)
8
+ [![Code Climate](https://codeclimate.com/github/atomicobject/motion-objection.png)](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
@@ -43,7 +43,7 @@ module Objection
43
43
  else
44
44
  prop = arg.split("/").last
45
45
  attr_accessor prop
46
- @_type_mappings[prop] = arg
46
+ @_type_mappings[prop] = arg.to_s
47
47
  properties << prop
48
48
  end
49
49
  end
@@ -1,16 +1,11 @@
1
1
  class RubyPropertyReflector
2
- NAMESPACE_SEPARTOR = "/"
3
2
 
4
3
  def self.propertyForClass(klass, andProperty: property)
5
- mapping = klass.send(:objectionTypeMappings)[property]
6
- if mapping.is_a? Class
7
- dependency_type = mapping
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
@@ -0,0 +1,3 @@
1
+ class String
2
+ include Objection::Inflector
3
+ end
@@ -1,3 +1,3 @@
1
1
  module Objection
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  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.2
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-06 00:00:00.000000000 Z
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