Skip to content

Instantly share code, notes, and snippets.

@rbrigby
rbrigby / ruby_loop.rb
Last active December 4, 2018 20:07
Ruby Loops and Tricks
thing_list = []
f = File.open("/Users/ryan/Desktop/foobar.log", "r")
f.each_line do |line|
foo = Foo.where(id: 3).first
thing_hash = {}
if foo
thing_hash = {id: foo.id, stuff: foo.stuff}
thing_list << thing_hash
end
end