# SOT: Ruby Question

**URL:** <https://www.ruby-forum.com/t/sot-ruby-question/196867>\
**Category:** Rails\
**Created:** [December 30, 2008, 10:55am UTC](https://www.ruby-forum.com/t/sot-ruby-question/196867 "2008-12-30T10:55:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeffrey\_LSTaylor](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/ee7513/32.png) [@Jeffrey\_LSTaylor](https://www.ruby-forum.com/u/Jeffrey_LSTaylor)\
**Post date:** [December 30, 2008, 10:55am UTC](https://www.ruby-forum.com/t/sot-ruby-question/196867/1 "2008-12-30T10:55:21Z")

</div>

I have the following code. It works but it seems to me that there must  
be a  
clearer, more compact way. Is there a way in Ruby to pass a method name  
to a  
method? Something simpler than a block or lambda?

TIA,  
Jeffrey

module Preload  
def Preload.info\_msg(msg)  
Preload.common\_msg(msg) {|msg| RAILS\_DEFAULT\_LOGGER.info msg}  
end

def Preload.debug\_msg(msg)  
Preload.common\_msg(msg, lambda{|msg| RAILS\_DEFAULT\_LOGGER.debug  
msg})  
end

def Preload.common\_msg(msg, logger = nil)  
puts msg  
if logger  
logger.call(msg)  
else  
yield msg  
end  
msg  
end  
end
