Mega Code Archive

 
Categories / Ruby / Reflection
 

Use instance_of for robustness

# don't do the block (do |t|...end) unless the variable myString is a string. myString = "asdf" if myString.instance_of?( String )   myString.split.each do |t|      puts t   end end