Skip to content

Instantly share code, notes, and snippets.

@jaydonnell
Forked from Musfuut/debug_line.rb
Created December 23, 2009 22:01
Show Gist options
  • Save jaydonnell/262846 to your computer and use it in GitHub Desktop.
Save jaydonnell/262846 to your computer and use it in GitHub Desktop.
def debug_line(*list)
ret = "Debug: "
0.step(list.length - 2, 2) do |x|
label, value = list[x,x+2]
ret += "#{label} = '#{value}', "
end
puts ret
end
debug_line("a", 10, "b", 20)
# Should print "Debug: a = '10', b = '20', "
# For some reason the second value (10 in this case) is swallowed every time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment