In addition to TIG's info, you should move all the one-time code outside the loop.
model = Sketchup.active_model
entities = model.active_entities
path = Sketchup.find_support_file "mymodel.skp" ,"Components/"
. . .
I also heartily recommend that you use four-space indentation in spite of the fact that two spaces is a Ruby convention. Four is much more readable which is why it is mandatory in Python, convention in C++, Java, JavaScript, ... (every language I know, except Ruby).
New languages are always a PITA. Fortunately, quite a small subset of Ruby is all you really need to create SketchUp plugins.