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.
我正在使用 Ruby 1.9.3,当我执行时Date.today,我得到NoMethodError: undefined method了今天的 Date:Class`
Date.today
NoMethodError: undefined method
我对此感到很困惑,因为它确实出现在文档中。虽然我知道这是 2.0 的文档,但我看到的答案可以追溯到它在 1.8.7 中实施的时候。这是在 1.9 中删除的吗?
你有require 'date'吗?
require 'date'
> require 'date' => true > Date.today => #<Date: 2013-03-12 ((2456364j,0s,0n),+0s,2299161j)>