- B
- D
- E
- F
- G
- H
- 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 |
实例公共方法
bytes() 链接
启用字节计算和声明的使用,例如 45.bytes + 2.6.megabytes
2.bytes # => 2
源:显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 15 def bytes self end
days() 链接
返回一个与提供的日期数匹配的 Duration 实例。
2.days # => 2 days
来源:显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 37 def days ActiveSupport::Duration.days(self) end
exabytes() 链接
返回与提供的 exabytes 等效的字节数。
2.exabytes # => 2_305_843_009_213_693_952
来源:显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 63 def exabytes self * EXABYTE end
fortnights() 链接
返回与提供的 fortnight 数匹配的 Duration 实例。
2.fortnights # => 4 weeks
来源:显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 53 def fortnights ActiveSupport::Duration.weeks(self * 2) end
gigabytes() 链接
返回与提供的 gigabytes 等效的字节数。
2.gigabytes # => 2_147_483_648
来源:显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 39 def gigabytes self * GIGABYTE end
hours() 链接
返回与提供的 hours 数匹配的 Duration 实例。
2.hours # => 2 hours
来源:显示 | 在 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
in_milliseconds() 链接
返回与提供的秒数等效的毫秒数。与标准时间持续时间一起使用。
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
来源:显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 23 def kilobytes self * KILOBYTE end
兆字节() 链接
返回与提供的兆字节等效的字节数。
2.megabytes # => 2_097_152
来源:显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 31 def megabytes self * MEGABYTE end
分钟() 链接
返回与提供的分钟数匹配的持续时间实例。
2.minutes # => 2 minutes
来源:显示 | 在 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
来源:显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 55 def petabytes self * PETABYTE end
seconds() 链接
返回一个与提供的秒数匹配的 Duration 实例。
2.seconds # => 2 seconds
源:显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 13 def seconds ActiveSupport::Duration.seconds(self) end
terabytes() 链接
返回与提供的太字节数等效的字节数。
2.terabytes # => 2_199_023_255_552
源:显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 47 def terabytes self * TERABYTE end
weeks() 链接
返回一个与提供的周数匹配的 Duration 实例。
2.weeks # => 2 weeks
源:显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 45 def weeks ActiveSupport::Duration.weeks(self) end
zettabytes() 链接
返回与提供的泽字节数等效的字节数。
2.zettabytes # => 2_361_183_241_434_822_606_848
源:显示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 71 def zettabytes self * ZETTABYTE end