Short answer: 'class' is not a selector on UIView instances
Long answer:
# query( < look for some views >, < selector on the views found > )
# look for buttons marked 'big button' and call 'isSelected' selector on them
query("button marked:'big button'", :isSelected")
# look for labels marked 'title' and call 'text' selector on them
query("label marked:'title'", :text)
# look for all views and call 'class' selector on them
# whoops! 'class' is not a selector on UIView instances
query "*", :class
Taking a step back, I think I know what you are trying to do - get a comprehensive list of views that are visible.
Have a look at https://github.com/jmoody/briar/blob/master/lib/briar/irbrc.rb
Example output is here: https://gist.github.com/jmoody/8031917
Instead of calling 'class' in the query, iterate over the results returned by query and look for the value of the 'class' key.
query('*').map { |result| result['class'] }