rexle 0.6.2 → 0.6.3
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.
- data/lib/rexle.rb +11 -2
- metadata +1 -1
data/lib/rexle.rb
CHANGED
@@ -134,7 +134,6 @@ class Rexle
|
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
137
|
-
#a.shift # added by jr 171110
|
138
137
|
rlist = rlist.flatten(1) unless not(rlist.is_a? Array) or (rlist.length > 1 and rlist[0].is_a? Array)
|
139
138
|
rlist = [rlist] if rlist.is_a? Rexle::Element
|
140
139
|
rlist
|
@@ -150,7 +149,17 @@ class Rexle
|
|
150
149
|
|
151
150
|
alias add add_element
|
152
151
|
|
153
|
-
def add_attribute(
|
152
|
+
def add_attribute(*x)
|
153
|
+
|
154
|
+
procs = {
|
155
|
+
Hash: lambda {|x| x[0] || {}},
|
156
|
+
String: lambda {|x| Hash[*x]}
|
157
|
+
}
|
158
|
+
h = procs[x[0].class.to_s.to_sym].call(x)
|
159
|
+
|
160
|
+
@attributes.merge! h
|
161
|
+
end
|
162
|
+
|
154
163
|
def add_text(s) @value = s; self end
|
155
164
|
def attributes() @attributes end
|
156
165
|
def children() @child_elements end
|