to_aがない件
Ruby2.0って
to_aってなくなっちゃったの?
undefined method `to_a' for "hoge":String (NoMethodError)
def clever_print(*args) printArray = [] args.each {|arg| printArray << arg.to_a # to_s だと思ったとおりに表示されない } puts printArray.join(" ") end clever_print( { :Rails => 3.0 })#=> OK clever_print(["Ruby"])#=> OK clever_print(["Ruby"], "the", ["Programming", "Language"])#=> NG #=> Ruby the Programming Language ←こういう風に出て欲しいけど出ない clever_print(["Agile", "Web", "Development"], "with", { :Rails => 3.0 }) #=> Agile Web Development with Rails 3.0 ←こういう風に出て欲しいけど出ない
うーん。