You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
274 B
Ruby
22 lines
274 B
Ruby
11 years ago
|
class JsonFileWriter
|
||
|
|
||
|
def write_enumerable(file, array)
|
||
|
first = true
|
||
|
file << '['
|
||
|
|
||
|
array.each do |item|
|
||
|
if first
|
||
|
first = false
|
||
|
else
|
||
|
file << ','
|
||
|
end
|
||
|
|
||
|
file << item.to_json
|
||
|
end
|
||
|
|
||
|
file << ']'
|
||
|
file.close
|
||
|
end
|
||
|
|
||
|
end
|