DEV Community


Discussion on: CSV Challenge

jorinvo profile image
jorin Author • Edited

Ruby is still one of the most pretty languages!
Maybe you can use the open(url).read from require 'open-uri' instead of curl to allow it to run on other systems 🙂

Alernatively could look like this: "#{ '%Y%m%d'}.csv", 'w' do |csv|
  JSON.parse(open(ARGV[0]).read).each { |x| csv << x if x['creditcard'] }
rpalo profile image
Ryan Palo

Oh, I like that!

  1. I didn't know about those extra options for CSV. Awesome.
  2. I didn't know about the open-uri built-in. Also awesome.
  3. I love the short and sweet each block! It even feels a little Pythonic, which is nice. Also also awesome!