Skip to content

Instantly share code, notes, and snippets.

# brainfreeze!
# what is the idiomatic ruby for this:
# if the var is an array, do_something with each element, otherwise just do something with the var
if var.is_a?(Array)
var.each do |element|
do_something(element)
end
else
do_something(var)
end