Implementing operator precedence in my calculator interpreter

As part of learning Ruby am trying to implement a basic interpreter
which reads input and do basic arithmetic calculations. So far basic
arithmetic operations are working but having problem in operator
precedence. Which is not handled yet. This is the code. Am at a beginner
level. Any mistakes in this code are due to my lack of knowledge. How
this code can be modified to handle operator precedence.

Sample output
2+2+2 = 6 #correct
10+10/2 = 10 # incorrect as in irb answer must be 15

Link to file :

Take a look at this algorithm:

It is a basic rather straight-forward algorithm for parsing infix
notation with operator precedence and convert it to reversed Polish
notation, which is easy to evaluate.