rexle 0.5.13 → 0.5.14

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.
Files changed (2) hide show
  1. data/lib/rexle.rb +6 -3
  2. metadata +2 -2
data/lib/rexle.rb CHANGED
@@ -149,7 +149,7 @@ class Rexle
149
149
 
150
150
  alias add add_element
151
151
 
152
- def add_attribute(h={}) @attributes.merge h end
152
+ def add_attribute(h={}) @attributes.merge! h end
153
153
  def attributes() @attributes end
154
154
  def children() @child_elements end
155
155
  def children=(a) @child_elements = a end
@@ -312,7 +312,8 @@ class Rexle
312
312
  def write() "<?xml version='1.0' encoding='UTF-8'?>\n" + xml end
313
313
  def xml()
314
314
  body = scan_print(self.root.children).join
315
- "<%s>%s</%s>" % [self.root.name, body, self.root.name]
315
+ a = self.root.attributes.to_a.map{|k,v| "%s='%s'" % [k,v]}
316
+ "<%s%s>%s</%s>" % [self.root.name, a.empty? ? '' : a, body, self.root.name]
316
317
  end
317
318
 
318
319
  private
@@ -335,7 +336,9 @@ class Rexle
335
336
  RexleParser.new(x).to_a
336
337
  end
337
338
  else
338
- RexleParser.new(x).to_a
339
+ RexleParser.new(x).to_achild_schema = 'b[name]'
340
+ record = Rexle.new PolyrexSchema.new(child_schema).to_s
341
+ record.root.add_attribute({'id' => @id.to_s})
339
342
  end
340
343
 
341
344
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rexle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.13
4
+ version: 0.5.14
5
5
  platform: ruby
6
6
  authors: []
7
7
 
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-11-23 00:00:00 +00:00
12
+ date: 2010-11-25 00:00:00 +00:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency