Find the orientation of a component relative to the model

P.S. - Please use correct coding language prefix so code is rendered correctly color lexed for Ruby.