Skip to content

Instantly share code, notes, and snippets.

@danarnold
Last active December 8, 2015 00:45
Show Gist options
  • Save danarnold/8c6f7637498976f95eef to your computer and use it in GitHub Desktop.
Save danarnold/8c6f7637498976f95eef to your computer and use it in GitHub Desktop.
Identify non-basic types in deep nested data structures by looking at their classes
def class_id(structure)
if !structure.is_a?(Hash) && !structure.is_a?(Array)
puts "#{structure}: #{structure.class}"
return
else
structure.each { |e| class_id(e) }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment