Created
January 24, 2016 01:35
-
-
Save anonymous/932d4c5d72af5b153045 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def show_obj(class_param) | |
available_objects_array = ObjectSpace.each_object(class_param).select {|x| x} | |
local_variables_prep = local_variables.delete_if {|y| eval(y.to_s).class != class_param} | |
local_variables_array = local_variables_prep.reverse.map {|z| z.to_s} | |
# Interleave objects and variables arrays | |
objects_and_variables_array = local_variables_array.zip(available_objects_array).flatten.compact | |
puts "available_objects_array:" | |
puts available_objects_array | |
puts "local_variables_prep:" | |
puts local_variables_prep | |
puts "local_variables_array:" | |
puts local_variables_array | |
puts "objects_and_variables_array:" | |
puts objects_and_variables_array | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment