Check If An Array Consists of Integers
[1, 2, 3, 4, 5].all? {|i| i.is_a?(Integer) } #=> True
JSON.parse("[1,2,3,4]").all? {|i| i.is_a?(Integer) } #=> True
Written by Kerem Bozdas
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Related Tags
#ruby
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#