ダブルクォーテーション or シングルクォーテーション
require "benchmark" Benchmark.bm { |bm| bm.report("double") { 20000000.times { a = "strings" } } bm.report("single") { 20000000.times { a = 'strings' } } }
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] user system total real double 7.625000 0.000000 7.625000 ( 7.828000) single 7.672000 0.000000 7.672000 ( 7.843000)
ruby 1.9.2dev (2010-04-27 trunk 27505) [i386-mingw32] user system total real double 4.250000 0.000000 4.250000 ( 4.343750) single 4.344000 0.016000 4.360000 ( 4.406250)
「変数の展開をしないときは '' で囲んだほうがいい(キリッ」とか書いてあるのを見たことがあるんだけど、どうでも良すぎる。コーディングルールのほうに従うべき。差はない。