# 1.step(3, SimpleDelegator.new(Rational(1,2))

**URL:** <https://www.ruby-forum.com/t/1-step-3-simpledelegator-new-rational-1-2/138400>\
**Category:** Development\
**Created:** [May 22, 2008, 4:49pm UTC](https://www.ruby-forum.com/t/1-step-3-simpledelegator-new-rational-1-2/138400 "2008-05-22T16:49:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tanaka\_A](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/c67d28/32.png) [@Tanaka\_A](https://www.ruby-forum.com/u/Tanaka_A)\
**Post date:** [May 22, 2008, 4:49pm UTC](https://www.ruby-forum.com/t/1-step-3-simpledelegator-new-rational-1-2/138400/1 "2008-05-22T16:49:34Z")

</div>

1.step(3, Rational(1,2)) e$B$,Nc30$K$J$i$J$$$N$Ke(B  
1.step(3, SimpleDelegator.new(Rational(1,2))) e$B$,Nc30$K$J$k$Ne(B  
e$B$OJQ$G$O$J$$$G$7$g$&$+!#e(B

% ./ruby -v -rdelegate -e ‘1.step(3, SimpleDelegator.new(Rational(1,2)))  
{|x| p x }’  
ruby 1.9.0 (2008-05-22 revision 16533) [i686-linux]  
/home/akr/ruby/yarvo0/lib/ruby/1.9.0/delegate.rb:225: warning: instance  
variable @delegate\_sd\_obj not initialized  
1  
Rational(3, 2)  
-e:1:in `+': SimpleDelegator can't be coerced into Rational (TypeError) from -e:1:in`step’  
from -e:1:in `’

% ./ruby -v -e ‘1.step(3, Rational(1,2)) {|x| p x }’  
ruby 1.9.0 (2008-05-22 revision 16533) [i686-linux]  
1  
Rational(3, 2)  
Rational(2, 1)  
Rational(5, 2)  
Rational(3, 1)
