title: Operate on and update a value in Ruby?
body: <p>I have an initial value <code>x</code> and a list of operators, call them <code>op1</code>, <code>op2</code>, <code>op3</code>, etc.</p>
  
  <p>The value I would like to compute is <code>op1(op2(op3(x)))</code>. The number of operators is variable. What is the most Ruby way to do this? </p>
  
  <p>Here is an example in code:</p>
  
  <pre><code>class Op1
    def operate arg
      arg + 1
    end
  end
  
  class Op2
    def operate arg
      arg + 2
    end
  end
  
  x = 1
  Op1.new.operate(Op2.new.operate(x))
  =&gt; 4
  </code></pre>