- B
- D
- E
- F
- G
- H
-
- 小時,
- 小時,
- html_safe?
- I
- K
- M
- P
- S
- T
- W
- Z
常數
艾位元組 | = | 拍位元組 * 1024 |
吉位元組 | = | 百萬位元組 * 1024 |
千位元組 | = | 1024 |
百萬位元組 | = | 千位元組 * 1024 |
拍位元組 | = | 兆位元組 * 1024 |
兆位元組 | = | 吉位元組 * 1024 |
澤位元組 | = | 艾位元組 * 1024 |
實例公開方法
位元組() 連結
啟用位元組計算和宣告,例如 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() 連結
傳回等於所提供的 exabyte 數量的位元組數。
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() 連結
傳回與所提供的半月數相符的 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() 連結
傳回等於所提供的 gigabyte 數量的位元組數。
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() 連結
傳回與所提供的時數相符的 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
kilobytes() 連結
傳回等於所提供千位元組的位元組數。
2.kilobytes # => 2048
來源:顯示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 23 def kilobytes self * KILOBYTE end
megabytes() 連結
傳回等於所提供百萬位元組的位元組數。
2.megabytes # => 2_097_152
來源:顯示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 31 def megabytes self * MEGABYTE end
minutes() 連結
傳回與所提供的分鐘數相符的 Duration 執行個體。
2.minutes # => 2 minutes
來源:顯示 | 在 GitHub 上
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 21 def minutes ActiveSupport::Duration.minutes(self) end
petabytes() 連結
傳回等於所提供的 petabytes 的位元組數。
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() 連結
傳回等於所提供的 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() 連結
傳回等於所提供 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