crayon-syntax-highlighter/util/lines_to_array.rb
2019-08-30 19:30:19 +02:00

11 lines
260 B
Ruby

#!/usr/bin/env ruby
# Converts lines from a file into an array of strings.
if ARGV.size == 0
puts "lines_to_array.rb <file>"
else
lines = File.readlines(ARGV[0])
lines = lines.map do |line|
"'" + line.strip + "'"
end
puts '[' + lines.join(',') + ']'
end