Skip to content

Instantly share code, notes, and snippets.

@mischa
Forked from anonymous/validate_quickly.rb
Created December 12, 2008 15:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mischa/35169 to your computer and use it in GitHub Desktop.
Save mischa/35169 to your computer and use it in GitHub Desktop.
if [child, parent, grandpa, president, food, ink].all{|e| e.valid?}
... #do stuff
end
>> %w{foo, bar, baz}.all?{|e| e.is_a?(String)}
=> true
>> ["foo", "bar", 1].all?{|e| e.is_a?(String)}
=> false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment