Skip to content

Instantly share code, notes, and snippets.

@bchase
Created July 4, 2015 07:14
Show Gist options
  • Select an option

  • Save bchase/1c2e584f764e4b0ca5a4 to your computer and use it in GitHub Desktop.

Select an option

Save bchase/1c2e584f764e4b0ca5a4 to your computer and use it in GitHub Desktop.
# before
lyrics.each do |lyric|
rules.each do |rule|
clip = Clip.new \
song_path: song_path,
lyric: lyric,
rule: rule
arr << clip
end
end
# after
lyrics.product(rules).each do |l,r|
clip = Clip.new \
song_path: song_path, lyric: l, rule: r
arr << clip
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment