conject 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/lib/conject/class_ext_construct_with.rb +3 -3
- data/lib/conject/object_factory.rb +7 -2
- data/lib/conject/version.rb +1 -1
- metadata +4 -4
data/CHANGELOG
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
Conject v0.1.5
|
2
|
+
* Using __send__ instead of send. This avoids collisions with actual methods on target objects named "send"
|
3
|
+
* Added a more descriptive error handler when a constructor call fails in ObjectFactory
|
4
|
+
|
1
5
|
Conject v0.1.4
|
2
6
|
* Removed Conject::BorroredInflector, moved copies of the underscore and camelize functions into Conject::Utilities
|
3
7
|
|
@@ -82,7 +82,7 @@ class Class
|
|
82
82
|
obj = allocate
|
83
83
|
if has_object_definition?
|
84
84
|
# Apply the given components
|
85
|
-
obj.
|
85
|
+
obj.__send__(:set_components, component_map)
|
86
86
|
else
|
87
87
|
raise "#{self.class} has an ancestor that uses construct_with, but has not declared any component dependencies. Will not be able to instantiate!"
|
88
88
|
end
|
@@ -90,10 +90,10 @@ class Class
|
|
90
90
|
arg_count = obj.method(:initialize).arity
|
91
91
|
case arg_count
|
92
92
|
when 0
|
93
|
-
obj.
|
93
|
+
obj.__send__ :initialize
|
94
94
|
|
95
95
|
when 1, -1 # See Footnote a) at the bottom of this file
|
96
|
-
obj.
|
96
|
+
obj.__send__ :initialize, component_map
|
97
97
|
|
98
98
|
else
|
99
99
|
# We're not equipped to handle this
|
@@ -30,7 +30,7 @@ module Conject
|
|
30
30
|
end
|
31
31
|
|
32
32
|
# Stuff an internal back reference to the object context into the new object:
|
33
|
-
object.
|
33
|
+
object.__send__(:instance_variable_set, :@_conject_object_context, object_context)
|
34
34
|
|
35
35
|
return object
|
36
36
|
end
|
@@ -64,7 +64,12 @@ module Conject
|
|
64
64
|
|
65
65
|
object = nil
|
66
66
|
Conject.override_object_context_with object_context do
|
67
|
-
|
67
|
+
begin
|
68
|
+
object = constructor_func.call
|
69
|
+
rescue Exception => ex
|
70
|
+
origin = "#{e.message}\n\t#{e.backtrace.join("\n\t")}"
|
71
|
+
raise "Error while constructing object '#{name}' of class #{klass}: #{origin}"
|
72
|
+
end
|
68
73
|
end
|
69
74
|
end
|
70
75
|
|
data/lib/conject/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conject
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -199,7 +199,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
199
199
|
version: '0'
|
200
200
|
segments:
|
201
201
|
- 0
|
202
|
-
hash:
|
202
|
+
hash: -2394895087523991076
|
203
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
204
|
none: false
|
205
205
|
requirements:
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
version: '0'
|
209
209
|
segments:
|
210
210
|
- 0
|
211
|
-
hash:
|
211
|
+
hash: -2394895087523991076
|
212
212
|
requirements: []
|
213
213
|
rubyforge_project:
|
214
214
|
rubygems_version: 1.8.24
|