方法
- B
- D
- E
- F
- G
- H
-
- 小时,
- 小时,
- html_safe?
- I
- K
- M
- P
- S
- T
- W
- Z
常量
| EXABYTE | = | PETABYTE * 1024 |
| GIGABYTE | = | MEGABYTE * 1024 |
| KILOBYTE | = | 1024 |
| MEGABYTE | = | KILOBYTE * 1024 |
| PETABYTE | = | TERABYTE * 1024 |
| TERABYTE | = | GIGABYTE * 1024 |
| ZETTABYTE | = | EXABYTE * 1024 |
实例公共方法
字节() 链接
启用字节计算和声明的使用,例如 45.bytes + 2.6.megabytes
2.bytes # => 2
也别名: byte
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 15 def bytes self end
天() 链接
返回一个匹配指定天数的 Duration 实例。
2.days # => 2 days
也别名: day
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 37 def days ActiveSupport::Duration.days(self) end
艾字节() 链接
返回等同于指定艾字节的字节数。
2.exabytes # => 2_305_843_009_213_693_952
也别名: exabyte
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 63 def exabytes self * EXABYTE end
两周() 链接
返回一个匹配指定两周的 Duration 实例。
2.fortnights # => 4 weeks
也别名: fortnight
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 53 def fortnights ActiveSupport::Duration.weeks(self * 2) end
吉字节() 链接
返回等同于指定吉字节的字节数。
2.gigabytes # => 2_147_483_648
也别名: gigabyte
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 39 def gigabytes self * GIGABYTE end
小时() 链接
返回一个匹配指定小时的 Duration 实例。
2.hours # => 2 hours
也别名: hour
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 29 def hours ActiveSupport::Duration.hours(self) end
html_safe?() 链接
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/string/output_safety.rb, line 13 def html_safe? true end
毫秒数() 链接
返回等同于指定秒数的毫秒数。用于标准时间时长。
2.in_milliseconds # => 2000 1.hour.in_milliseconds # => 3600000
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 63 def in_milliseconds self * 1000 end
千字节() 链接
返回等同于指定千字节的字节数。
2.kilobytes # => 2048
也别名: kilobyte
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 23 def kilobytes self * KILOBYTE end
兆字节() 链接
返回等同于指定兆字节的字节数。
2.megabytes # => 2_097_152
也别名: megabyte
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 31 def megabytes self * MEGABYTE end
分钟() 链接
返回一个匹配指定分钟的 Duration 实例。
2.minutes # => 2 minutes
也别名: minute
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 21 def minutes ActiveSupport::Duration.minutes(self) end
拍字节() 链接
返回等同于指定拍字节的字节数。
2.petabytes # => 2_251_799_813_685_248
也别名: petabyte
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 55 def petabytes self * PETABYTE end
秒() 链接
返回一个匹配指定秒数的 Duration 实例。
2.seconds # => 2 seconds
也别名: second
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 13 def seconds ActiveSupport::Duration.seconds(self) end
太字节() 链接
返回等同于指定太字节的字节数。
2.terabytes # => 2_199_023_255_552
也别名: terabyte
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 47 def terabytes self * TERABYTE end
周() 链接
返回一个匹配指定周数的 Duration 实例。
2.weeks # => 2 weeks
也别名: week
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 45 def weeks ActiveSupport::Duration.weeks(self) end
泽字节() 链接
返回等同于指定泽字节的字节数。
2.zettabytes # => 2_361_183_241_434_822_606_848
也别名: zettabyte
来源: 显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 71 def zettabytes self * ZETTABYTE end