From: "Jan E." Date: 2012-11-01T14:26:02+09:00 Subject: Re: need regex to check for consonants and put number after each consonant I think you misunderstand how methods and blocks work. You continue to write a block after the method calls, but your method doesn't use blocks (there's no "yield"). So all the "print c" and "num_string += c" etc. is simply ignored. It has no effect at all. What your method does is return the result of the conversion. So you can output the return value, store it in a variable etc.: #---------------------------------- num = Num.new # convert to num num_converted = num.to_num("Wow! Look at this get converted to Num!") puts num_converted # convert back to English puts num.to_english(num_converted) #---------------------------------- Of course you *could* use blocks, but then you'd have to define your method accordingly. Judging from your examples, it seems you want to pass the conversion result to the block: #---------------------------------- class Num def to_num( string ) res = string.gsub( /(?<=[bcdfghj-np-tvwxz])/i, '0' ) yield res if block_given? res end def to_english( num_string ) res = num_string.gsub( /[0]/, '' ) yield res if block_given? res end end num = Num.new num.to_num( "Wow! Look at this get converted to Num!" ) do |result| puts result end #---------------------------------- However, I can't see any use for this block variant, because the method doesn't do anything useful with the block. So I'd simply return the value like above and not use blocks. -- Posted via http://www.ruby-forum.com/.