種類
- インスタンスメソッド (932)
- 特異メソッド (302)
- 定数 (176)
- モジュール関数 (88)
- クラス (55)
クラス
- Array (11)
- Data (4)
- File (104)
-
File
:: Stat (44) - IO (11)
- Integer (22)
- Mutex (2)
- Object (22)
-
Process
:: Tms (88) - Random (33)
- String (22)
- Thread (11)
-
Thread
:: ConditionVariable (9) -
Thread
:: Mutex (9) - Time (787)
- UnboundMethod (11)
モジュール
-
File
:: Constants (11) -
GC
:: Profiler (44) - Kernel (66)
- Process (187)
キーワード
- % (11)
- * (22)
- + (11)
- - (22)
- <=> (11)
- ArgumentError (11)
-
CLOCK
_ BOOTTIME (11) -
CLOCK
_ BOOTTIME _ ALARM (11) -
CLOCK
_ MONOTONIC (11) -
CLOCK
_ PROCESS _ CPUTIME _ ID (11) -
CLOCK
_ REALTIME (11) -
CLOCK
_ REALTIME _ ALARM (11) -
CLOCK
_ REALTIME _ COARSE (11) -
CLOCK
_ REALTIME _ FAST (11) -
CLOCK
_ REALTIME _ PRECISE (11) -
CLOCK
_ THREAD _ CPUTIME _ ID (11) -
CLOCK
_ UPTIME (11) -
CLOCK
_ UPTIME _ FAST (11) -
CLOCK
_ UPTIME _ PRECISE (11) -
CLOCK
_ UPTIME _ RAW (11) -
CLOCK
_ UPTIME _ RAW _ APPROX (11) - ETIME (11)
- ETIMEDOUT (11)
- Float (11)
- NOATIME (11)
- RuntimeError (11)
- Time (11)
-
_ dump (11) - asctime (11)
- at (47)
- atime (33)
- birthtime (31)
- ceil (5)
-
clock
_ gettime (11) - cstime (11)
- cstime= (11)
- ctime (44)
- cutime (11)
- cutime= (11)
- day (11)
- define (4)
- dst? (11)
- eql? (11)
- floor (5)
- format (11)
- friday? (11)
- getgm (11)
- getlocal (22)
- getutc (11)
- gm (22)
- gmt? (11)
-
gmt
_ offset (11) - gmtime (11)
- gmtoff (11)
-
handle
_ interrupt (11) - hash (11)
- hour (11)
- inspect (16)
- isdst (11)
- local (22)
- localtime (22)
- lutime (7)
- mday (11)
- min (11)
- mktime (22)
- mon (11)
- monday? (11)
- month (11)
- mtime (33)
- new (25)
- now (11)
- nsec (11)
- rand (33)
-
raw
_ data (11) - report (11)
- result (11)
- round (11)
- saturday? (11)
- sec (11)
- select (22)
- sleep (11)
-
source
_ location (11) - sprintf (11)
- stime (11)
- stime= (11)
- strftime (11)
- subsec (11)
- succ (7)
- sunday? (11)
- test (22)
- thursday? (11)
- times (33)
-
to
_ a (11) -
to
_ f (11) -
to
_ i (11) -
to
_ r (11) -
to
_ s (11) -
total
_ time (11) - tuesday? (11)
-
tv
_ nsec (11) -
tv
_ sec (11) -
tv
_ usec (11) - usec (11)
- utc (33)
- utc? (11)
-
utc
_ offset (11) - utime (22)
- utime= (11)
- wait (9)
- wday (11)
- wednesday? (11)
- yday (11)
- year (11)
- zone (11)
検索結果
先頭5件
-
Random
# rand(range) -> Integer | Float (38.0) -
一様な擬似乱数を発生させます。
...端を含む場合は1、含まない場合は0です)。
range.end - range.begin が実数を返す場合も同様です。
このため range が Time の場合などにもうまく動作します。
引数が実数でも範囲でもない場合は Object#to_int で変換した値が指定され......(4.2 は除く)
prng.rand(0...4.2) # => 3.6148130397862865
# 2012年のすべての(秒単位)時刻から一つ選ばれる
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-......12年のすべての時刻から一つ選ばれる
# Time#- は秒数を float で返すため。
prng.rand(Time.new(2012, 1, 1) ... Time.new(2013,1,1)) # => 2012-02-25 03:11:42 +0900
# DateTime ではうまくいかない。というのは DateTime#- は
# Rational を返すため。
# Date#- も R... -
GC
:: Profiler . result -> String (26.0) -
GC のプロファイル情報をフォーマットし、文字列として返します。
...r.enable; a = Array.new(100000){ 'aa' }; puts GC::Profiler.result"
GC 5 invokes.
Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC Time(ms)
1 0.012 165600 212940 10647......の起動回数
: Invoke Time
Ruby が起動してから GC が起動するまでに経過した時間
: Use Size
ヒープ内での使用サイズ
: Total Size
ヒープ全体のサイズ
: Total Object
ヒープ内に存在するオブジェクトの個数
: GC Time
GC の処理時間
@... -
UnboundMethod
# source _ location -> [String , Integer] | nil (26.0) -
ソースコードのファイル名と行番号を配列で返します。
...合は nil を返します。
//emlist[例][ruby]{
require 'time'
Time.instance_method(:zone).source_location # => nil
Time.instance_method(:httpdate).source_location # => ["/Users/user/.rbenv/versions/2.4.3/lib/ruby/2.4.0/time.rb", 654]
//}
@see Proc#source_location, Method#source_locati... -
Data
. define(*args) -> Class (20.0) -
Data クラスに新しいサブクラスを作って、それを返します。
..."Current time is #{Time.now}")
else
NotFound.new
end
end
end
def fetch(url)
fetcher = HTTPFetcher.new
case fetcher.get(url)
in HTTPFetcher::Response(body)
body
in HTTPFetcher::NotFound
:NotFound
end
end
p fetch("http://example.com/") # => "Current time is 2023... -
Data
. define(*args) {|subclass| block } -> Class (20.0) -
Data クラスに新しいサブクラスを作って、それを返します。
..."Current time is #{Time.now}")
else
NotFound.new
end
end
end
def fetch(url)
fetcher = HTTPFetcher.new
case fetcher.get(url)
in HTTPFetcher::Response(body)
body
in HTTPFetcher::NotFound
:NotFound
end
end
p fetch("http://example.com/") # => "Current time is 2023... -
GC
:: Profiler . report(out = $ stdout) -> nil (14.0) -
GC::Profiler.result の結果を out に出力します。
...t[例][ruby]{
GC::Profiler.enable
GC.start
GC::Profiler.report
# => GC 4 invokes.
# Index Invoke Time(sec) Use Size(byte) Total Size(byte) Total Object GC Time(ms)
# 1 0.019 303720 1269840 31746... -
Kernel
. # format(format , *arg) -> String (14.0) -
format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。
...ます。
@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime
=== sprintf フォーマット
Ruby の sprintf フォーマットは基本的に C 言語の sprintf(3)
のものと同じです。......況によってフォーマットを変えたいが引数の順序を変えたくない場合に使
用します。
//emlist[][ruby]{
case ENV['LC_TIME']
when /^ja_JP/
fmt = "%1$d年%2$d月%3$d日"
else
fmt = "%2$02d/%03$2d/%1$02d"
end
p sprintf(fmt, 1, 4, 22) #=> "04/22/01"
//}
"*" の後に... -
Kernel
. # sprintf(format , *arg) -> String (14.0) -
format 文字列を C 言語の sprintf と同じように解釈し、 引数をフォーマットした文字列を返します。
...ます。
@param format フォーマット文字列です。
@param arg フォーマットされる引数です。
@see Kernel.#printf,Time#strftime,Date.strptime
=== sprintf フォーマット
Ruby の sprintf フォーマットは基本的に C 言語の sprintf(3)
のものと同じです。......況によってフォーマットを変えたいが引数の順序を変えたくない場合に使
用します。
//emlist[][ruby]{
case ENV['LC_TIME']
when /^ja_JP/
fmt = "%1$d年%2$d月%3$d日"
else
fmt = "%2$02d/%03$2d/%1$02d"
end
p sprintf(fmt, 1, 4, 22) #=> "04/22/01"
//}
"*" の後に... -
ArgumentError (8.0)
-
引数の数があっていないときや、数は合っていて、期待される振る舞いを持ってはいるが、期待される値ではないときに発生します。
...、数は合っていて、期待される振る舞いを持ってはいるが、期待される値ではないときに発生します。
例:
Time.at # => wrong number of arguments (0 for 1) (ArgumentError)
Array.new(-1) # => negative array size (ArgumentError)
など
@see TypeError......、数は合っていて、期待される振る舞いを持ってはいるが、期待される値ではないときに発生します。
例:
Time.at # => wrong number of arguments (given 0, expected 1..2) (ArgumentError)
Array.new(-1) # => negative array size (ArgumentError)
など... -
Kernel
. # Float(arg) -> Float (8.0) -
引数を浮動小数点数(Float)に変換した結果を返します。
...に発生します。
//emlist[例][ruby]{
p Float(4) #=> 4.0
p Float(4_000) #=> 4000.0
p Float(9.88) #=> 9.88
p Float(Time.gm(1986)) #=> 504921600.0
p Float(Object.new) # can't convert Object into Float (TypeError)
p Float(nil) # can't convert nil into Float (... -
Kernel
. # Float(arg , exception: true) -> Float | nil (8.0) -
引数を浮動小数点数(Float)に変換した結果を返します。
...に発生します。
//emlist[例][ruby]{
p Float(4) #=> 4.0
p Float(4_000) #=> 4000.0
p Float(9.88) #=> 9.88
p Float(Time.gm(1986)) #=> 504921600.0
p Float(Object.new) # can't convert Object into Float (TypeError)
p Float(nil) # can't convert nil into Float (... -
Object
# _ dump(limit) -> String (8.0) -
Marshal.#dump において出力するオブジェクトがメソッド _dump を定義している場合には、そのメソッドの結果が書き出されます。
...い場合や拡張ライブラリで定義し
たクラスのインスタンスがインスタンス変数以外に情報を保持する場合に
利用します。(例えば、クラス Time は、_dump/_load を定義して
います)
@see Object#marshal_dump, Object#marshal_load, Class#_load... -
Object
# inspect -> String (8.0) -
オブジェクトを人間が読める形式に変換した文字列を返します。
...の結果を使用して
オブジェクトを表示します。
//emlist[][ruby]{
[ 1, 2, 3..4, 'five' ].inspect # => "[1, 2, 3..4, \"five\"]"
Time.new.inspect # => "2008-03-08 19:43:39 +0900"
//}
inspect メソッドをオーバーライドしなかった場合、クラス名...