264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
|
# File 'lib/io.rb', line 264
def writeValueWithSpec(*args)
if args.length > 1
spec = args[1]
else
spec = @spec
end
val = args[0]
if spec.kind_of? Array
writeValue(val.length, LEON::type_check(val.length))
val.each { |v|
writeValueWithSpec(v, spec[0])
}
elsif spec.kind_of? Hash
if val.kind_of? Hash
spec.sort.each { |k, v|
writeValueWithSpec(val[k], v)
}
else
spec.sort.each { |k, v|
writeValueWithSpec(val.send(k), v)
}
end
elsif spec === Constants::BOOLEAN
writeValue(val, LEON::type_check(val), true)
else
writeValue(val, spec, true)
end
end
|