Skip to content

Instantly share code, notes, and snippets.

@jamesgecko
Created April 26, 2012 14:47
Show Gist options
  • Save jamesgecko/2500081 to your computer and use it in GitHub Desktop.
Save jamesgecko/2500081 to your computer and use it in GitHub Desktop.
case matches using ===
unknown, String, foo
unknown, Fixnum, 42
unknown, Array,
def exec_update(*params)
if params.empty?
puts 'empty'
else
params.each_with_index do |p, i|
case p
when String
puts 'string'
when Fixnum
puts 'int'
else
puts "unknown, #{p.class.to_s}, #{p.to_s}"
end
end
end
end
exec_update('foo', 42, [])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment