polyrex-createobject 0.4.8 → 0.4.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/polyrex-createobject.rb +13 -8
  2. metadata +11 -9
@@ -7,10 +7,10 @@ require 'rexle'
7
7
 
8
8
  class PolyrexCreateObject
9
9
 
10
- attr_accessor :id, :parent_node
10
+ attr_accessor :parent_node
11
11
 
12
12
  def initialize(schema, id='1')
13
- @id = id
13
+ @@id = id
14
14
 
15
15
  @schema = schema
16
16
  a = @schema.split('/')
@@ -21,7 +21,10 @@ class PolyrexCreateObject
21
21
  attach_create_handlers(names)
22
22
 
23
23
  end
24
-
24
+
25
+ def id=(s) @@id = s end
26
+ def id() @@id end
27
+
25
28
  def record=(node)
26
29
  @parent_node = node
27
30
  end
@@ -33,6 +36,7 @@ class PolyrexCreateObject
33
36
  %Q(
34
37
  def #{name}(params={}, id=nil,&blk)
35
38
 
39
+ id ||= @@id
36
40
  orig_parent = @parent_node
37
41
  new_parent = create_node(@parent_node, @rpaths['#{xpath}'], params, id).element('records')
38
42
 
@@ -53,6 +57,7 @@ class PolyrexCreateObject
53
57
  # top record
54
58
  methodx << %Q(
55
59
  def #{name}(params={}, id=nil,&blk)
60
+ id ||= @@id
56
61
  orig_parent = @parent_node
57
62
  self.record = @parent_node.element('records') unless @parent_node.name == 'records'
58
63
  self.record = create_node(@parent_node, @rpaths['#{xpath}'], params, id).element('records')
@@ -72,16 +77,16 @@ end
72
77
  record = Rexle.new PolyrexSchema.new(child_schema).to_s
73
78
 
74
79
  if id then
75
- @id = id
80
+ @@id = id
76
81
  else
77
- if @id.to_i.to_s == @id.to_s then
78
- @id = @id.to_s.succ
82
+ if @@id.to_i.to_s == @@id.to_s then
83
+ @@id = @id.to_s.succ
79
84
  else
80
- @id = @parent_node.element('count(//@id)').to_i + 2
85
+ @@id = @parent_node.element('count(//@id)').to_i + 2
81
86
  end
82
87
  end
83
88
 
84
- record.root.add_attribute({'id' => @id.to_s.clone})
89
+ record.root.add_attribute({'id' => @@id.to_s.clone})
85
90
 
86
91
  a = child_schema[/[^\[]+(?=\])/].split(',')
87
92
  summary = record.element('summary')
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polyrex-createobject
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ prerelease:
5
+ version: 0.4.9
5
6
  platform: ruby
6
7
  authors: []
7
8
 
@@ -9,19 +10,20 @@ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2011-02-28 00:00:00 +00:00
13
+ date: 2011-03-15 00:00:00 +00:00
13
14
  default_executable:
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: polyrex-schema
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
20
21
  requirements:
21
22
  - - ">="
22
23
  - !ruby/object:Gem::Version
23
24
  version: "0"
24
- version:
25
+ type: :runtime
26
+ version_requirements: *id001
25
27
  description:
26
28
  email:
27
29
  executables: []
@@ -42,21 +44,21 @@ rdoc_options: []
42
44
  require_paths:
43
45
  - lib
44
46
  required_ruby_version: !ruby/object:Gem::Requirement
47
+ none: false
45
48
  requirements:
46
49
  - - ">="
47
50
  - !ruby/object:Gem::Version
48
51
  version: "0"
49
- version:
50
52
  required_rubygems_version: !ruby/object:Gem::Requirement
53
+ none: false
51
54
  requirements:
52
55
  - - ">="
53
56
  - !ruby/object:Gem::Version
54
57
  version: "0"
55
- version:
56
58
  requirements: []
57
59
 
58
60
  rubyforge_project:
59
- rubygems_version: 1.3.5
61
+ rubygems_version: 1.5.2
60
62
  signing_key:
61
63
  specification_version: 3
62
64
  summary: polyrex-createobject