rexle 0.3.3 → 0.3.4

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 -2
  2. metadata +1 -1
@@ -211,7 +211,8 @@ class Rexle
211
211
  if match_found then
212
212
  raw_attributes, value = match_found.captures
213
213
  attributes = raw_attributes.scan(/(\w+\='[^']+')|(\w+\="[^"]+")/)\
214
- .map(&:compact).inject({}) do |r, x|
214
+ .map(&:compact).flatten.inject({}) do |r, x|
215
+
215
216
  attr_name, val = x.split(/=/)
216
217
  r.merge(attr_name => val[1..-2])
217
218
  end
@@ -250,7 +251,10 @@ class Rexle
250
251
  def scan_print(nodes)
251
252
 
252
253
  nodes.map do |x|
253
- out = ["<%s>" % x.name]
254
+ a = x.attributes.to_a.map{|k,v| "%s='%s'" % [k,v]}
255
+ tag = x.name + (a.empty? ? '' : ' ' + a.join(' '))
256
+
257
+ out = ["<%s>" % tag]
254
258
  out << scan_print(x.children)
255
259
  out << "</%s>" % x.name
256
260
  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.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors: []
7
7