Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这行的“应用程序错误”:
get '/' do time = Time.new content_type :json returnValue = { "day" => "%02d" % time.day, "month" => "%02d" % time.month, "year" => #{time.year} }\ .to_json "#{returnValue}" end
我究竟做错了什么 ?
那个部分:
{time.year}
不是有效的 Ruby 对象。
"year" => #{time.year}
是相同的
"year" =>
它不会关闭哈希,并且不是有效的 Ruby 对象。