polyrex-objects 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/polyrex-objects.rb +10 -1
- metadata +1 -1
data/lib/polyrex-objects.rb
CHANGED
@@ -8,8 +8,11 @@ require 'polyrex-createobject'
|
|
8
8
|
class PolyrexObjects
|
9
9
|
include REXML
|
10
10
|
|
11
|
-
def initialize(schema)
|
11
|
+
def initialize(schema, node=nil, id=nil)
|
12
12
|
|
13
|
+
@node = node
|
14
|
+
@id = id
|
15
|
+
|
13
16
|
a = schema.split('/')
|
14
17
|
a.shift
|
15
18
|
@class_names = []
|
@@ -53,6 +56,12 @@ class PolyrexObjects
|
|
53
56
|
|
54
57
|
}"
|
55
58
|
end
|
59
|
+
|
60
|
+
methodx = @class_names.map do |name|
|
61
|
+
%Q(def #{name.downcase}(); #{name}.new(@node, @id); end)
|
62
|
+
end
|
63
|
+
|
64
|
+
self.instance_eval(methodx.join("\n"))
|
56
65
|
|
57
66
|
|
58
67
|
end
|