跳至內容 跳至搜尋
方法
B
D
E
F
G
H
I
K
M
P
S
T
W
Z

常數

艾位元組 = 拍位元組 * 1024
 
吉位元組 = 百萬位元組 * 1024
 
千位元組 = 1024
 
百萬位元組 = 千位元組 * 1024
 
拍位元組 = 兆位元組 * 1024
 
兆位元組 = 吉位元組 * 1024
 
澤位元組 = 艾位元組 * 1024
 

實例公開方法

位元組()

別名: 位元組

位元組()

啟用位元組計算和宣告,例如 45.bytes + 2.6.megabytes

2.bytes # => 2
別名為: 位元組
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 15
def bytes
  self
end

day()

別名為:days

days()

傳回與所提供的日數相符的 Duration 實例。

2.days # => 2 days
別名為:day
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 37
def days
  ActiveSupport::Duration.days(self)
end

exabyte()

別名為:exabytes

exabytes()

傳回等於所提供的 exabyte 數量的位元組數。

2.exabytes # => 2_305_843_009_213_693_952
別名為:exabyte
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 63
def exabytes
  self * EXABYTE
end

fortnight()

別名為:fortnights

fortnights()

傳回與所提供的半月數相符的 Duration 實例。

2.fortnights # => 4 weeks
別名為:fortnight
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 53
def fortnights
  ActiveSupport::Duration.weeks(self * 2)
end

gigabyte()

別名為:gigabytes

gigabytes()

傳回等於所提供的 gigabyte 數量的位元組數。

2.gigabytes # => 2_147_483_648
別名為:gigabyte
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 39
def gigabytes
  self * GIGABYTE
end

hour()

別名為:hours

hours()

傳回與所提供的時數相符的 Duration 實例。

2.hours # => 2 hours
別名:hour
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 29
def hours
  ActiveSupport::Duration.hours(self)
end

html_safe?()

# 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
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 63
def in_milliseconds
  self * 1000
end

kilobyte()

別名:kilobytes

kilobytes()

傳回等於所提供千位元組的位元組數。

2.kilobytes # => 2048
別名:kilobyte
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 23
def kilobytes
  self * KILOBYTE
end

megabyte()

別名:megabytes

megabytes()

傳回等於所提供百萬位元組的位元組數。

2.megabytes # => 2_097_152
別名:megabyte
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 31
def megabytes
  self * MEGABYTE
end

minute()

別名:minutes

minutes()

傳回與所提供的分鐘數相符的 Duration 執行個體。

2.minutes # => 2 minutes
別名:minute
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 21
def minutes
  ActiveSupport::Duration.minutes(self)
end

petabyte()

別名:petabytes

petabytes()

傳回等於所提供的 petabytes 的位元組數。

2.petabytes # => 2_251_799_813_685_248
別名:petabyte
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 55
def petabytes
  self * PETABYTE
end

second()

別名:seconds

seconds()

傳回一個 Duration 實例,其與所提供的秒數相符。

2.seconds # => 2 seconds
別名:second
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 13
def seconds
  ActiveSupport::Duration.seconds(self)
end

terabyte()

別名:terabytes

terabytes()

傳回等於所提供的 terabytes 的位元組數。

2.terabytes # => 2_199_023_255_552
別名:terabyte
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 47
def terabytes
  self * TERABYTE
end

week()

別名:weeks

weeks()

傳回一個 Duration 實例,其與所提供的週數相符。

2.weeks # => 2 weeks
別名:week
# File activesupport/lib/active_support/core_ext/numeric/time.rb, line 45
def weeks
  ActiveSupport::Duration.weeks(self)
end

zettabyte()

別名:zettabytes

zettabytes()

傳回等於所提供 zettabytes 的位元組數。

2.zettabytes # => 2_361_183_241_434_822_606_848
別名為:zettabyte
# File activesupport/lib/active_support/core_ext/numeric/bytes.rb, line 71
def zettabytes
  self * ZETTABYTE
end