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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to