Time.advance被记录在哪里? [英] Where is Time.advance documented?

查看:224
本文介绍了Time.advance被记录在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

环顾四周,我发现了Ruby 时间类有时间提前#在网络上。这哪里是记录?我看到没有提到它在Ruby API文档这里

Looking around on the Web I found that the Ruby Time class has Time#advance. Where is this documented? I saw no mention of it in the Ruby API docs here.

有关API文档搜索功能表明,不存在所谓的超前的方法在任何地方。

The search function for the API docs indicated that there is no method called "advance" anywhere.

然而,在IRB ...

Nonetheless, in IRB...

>> t = Time.now
=> Thu Mar 05 16:08:57 -0800 2009
>> t.advance :months => 1
=> Sun Apr 05 16:08:57 -0700 2009

这让我为难......在文档的时间类的另一件事情,第一件事情它说的是可以实现的扩展,对于time.rb库中的文档中描述的时间类。

Another thing that puzzles me... In the docs for the time class, the first thing it says is "Implements the extensions to the Time class that are described in the documentation for the time.rb library."

他们是否意味的time.rb库实现扩展这一类?

Do they mean "the time.rb library implements extensions to this class?"

我想,也许这就是时间提前#从哪里来但我发现这个

I thought maybe that's where Time#advance came from but all I found was this.

推荐答案

这实际上是在 的ActiveSupport :: CoreExtensions ::数字::时间 模块。

It's actually in the ActiveSupport::CoreExtensions::Numeric::Time module.

这是我的抱怨和Ruby之一 - 这是不可能找到的每一个对象有方法融为一体prehensive文件,因为该方法列表取决于环境的变化。功能强大,具刺激性。

This is one of my gripes with Ruby - it's impossible to find comprehensive documentation for every method an object has, because the method list changes depending on the context. Powerful, yet irritating.

我工作的一个大的Rails应用程序,我没有在一段时间原本写的,有一次我谷歌我没有几分钟前实现识别方法......是的,在previous开发商在/ lib目录中定义它。

I'm working on a large Rails app that I did not write originally, and once in a while I google a method I don't recognize for a few minutes before realizing...yep, the previous developer defined it in /lib.

这篇关于Time.advance被记录在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆