It's often better to check that a parameter responds to the methods used, rather than checking class explicitly -- can make stubbing easier in tests if required, and fits better with Ruby's duck typing. e.g.

```ruby
raise "ages does not respond_to? :each and :each_with_index" unless ages.respond_to?(:each) && ages.respond_to?(:each_with_index)
raise "age values must respond_to? :to_i" unless ages.all? {|age| age.respond_to?(:to_i) }
```