# Method calling to Proc, want to confirm I understand

**URL:** <https://www.ruby-forum.com/t/method-calling-to-proc-want-to-confirm-i-understand/97986>\
**Category:** Ruby\
**Created:** [July 11, 2006, 9:54pm UTC](https://www.ruby-forum.com/t/method-calling-to-proc-want-to-confirm-i-understand/97986 "2006-07-11T21:54:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [July 11, 2006, 9:54pm UTC](https://www.ruby-forum.com/t/method-calling-to-proc-want-to-confirm-i-understand/97986/1 "2006-07-11T21:54:36Z")

</div>

Apologies, cause I’m trying to wrap my brain around this code and I have  
some questions about it.  
1- It seems that until ‘block.call’ what is getting passed into the  
method  
parameters is being held in que (so to speak). Or is that a wrong  
interpreation.  
2- How does the method know that it calls ‘25000 doublings’ first and  
then  
moves on to ‘count to a million’. I realize part of it is how the code  
is  
layed out but why couldn’t it just try the 25000 doublings again ?

Hope these type of questions are okay here.

TIA  
Stuart

def profile block\_description, &block  
start\_time = Time.now  
block.call  
duration = Time.now - start\_time  
puts block\_description+’ : ’ +duration.to\_s+’ seconds’  
end

profile ‘25000 doublings’ do  
number = 1  
25000.times do  
number = number + number  
end

puts number.to\_s.length.to\_s+’ digits’

# That’s the number of digits in this HUGE number.

end

profile ‘count to a million’ do  
number = 0  
1000000.times do  
number = number + 1  
end  
end
