るりまサーチ

最速Rubyリファレンスマニュアル検索!
984件ヒット [1-100件を表示] (0.036秒)

別のキーワード

  1. kernel exec
  2. kernel spawn
  3. kernel system
  4. kernel open
  5. kernel gsub

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

LoadError#path -> String | nil (35.0)

Kernel.#require や Kernel.#load に失敗したパスを返します。

...
Kernel
.#require や Kernel.#load に失敗したパスを返します。

begin
require 'this/file/does/not/exist'
rescue LoadError => e
e.path # => 'this/file/does/not/exist'
end

パスが定まらない場合は nil を返します。...

IO#puts(*obj) -> nil (31.0)

各 obj を self に出力し、それぞれの後に改行を出力します。 引数の扱いは Kernel.#puts と同じです。詳細はこちらを参照し てください。

...し、それぞれの後に改行を出力します。
引数の扱いは Kernel.#puts と同じです。詳細はこちらを参照し
てください。

@param obj 出力したいオブジェクトを指定します。Kernel.#puts と同じです。

@raise IOError 自身が書き込み用にオ...
...ープンされていなければ発生します。

@raise Errno::EXXX 出力に失敗した場合に発生します。

$stdout.puts("this", "is", "a", "test", [1, [nil, 3]])

#=>
this
is
a
test
1

3

@see Kernel.#puts...

Module#autoload(const_name, feature) -> nil (31.0)

定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。

...定数 const_name を最初に参照した時に feature を Kernel.#require するように設定します。

const_name が autoload 設定されていて、まだ定義されてない(ロードされていない)ときは、
autoload する対象を置き換えます。
const_name が(autoload...
...子を含めることはできません。
つまり、self の直下に定義された定数しか指定できません。

@param feature Kernel.#require と同様な方法で autoload する対象を指定する。

//emlist[例][ruby]{
# ------- /tmp/foo.rb ---------
class Foo
class Bar...
...nstant Bar referenced by Foo::Bar
# Bar
# nil
//}

これは以下のようにネストせずに定義したのと同じことです。

//emlist[例][ruby]{
class Foo
end
class Bar
end
p Foo::Bar
#=> -:5: warning: toplevel constant Bar referenced by Foo::Bar
# Bar
//}

@see Kernel.#autoload...
...ない場
合、NameError が発生します。

//emlist[例][ruby]{
# ------- /tmp/bar.rb ---------
class Bar
end
# ----- end of /tmp/bar.rb ----

class Foo
autoload :Bar, '/tmp/bar.rb'
end
p Foo::Bar
#=> -:4:in `<main>': uninitialized constant Foo::Bar (NameError)
//}

@see Kernel.#autoload...

IO#printf(format, *arg) -> nil (27.0)

C 言語の printf と同じように、format に従い引数 を文字列に変換して、self に出力します。

...IO を指定できないこと、引数を省略できないことを除けば Kernel.#printf と同じです。

@param format Kernel.#printf と同じです。print_format を参照してください。

@param arg Kernel.#printf と同じです。

@raise IOError 自身が書き込み用にオー...
...プンされていなければ発生します。

@raise Errno::EXXX 出力に失敗した場合に発生します。


@see Kernel.#printf...

Module#public_instance_method(name) -> UnboundMethod (27.0)

self の public インスタンスメソッド name をオブジェクト化した UnboundMethod を返します。

...を引数として与えると発生します。

//emlist[例][ruby]{
Kernel
.public_instance_method(:object_id) #=> #<UnboundMethod: Kernel#object_id>
Kernel
.public_instance_method(:p) # method `p' for module `Kernel' is private (NameError)
//}

@see Module#instance_method,Object#public_m...

絞り込み条件を変える

Random#rand -> Float (27.0)

一様な擬似乱数を発生させます。

...に負の数値を与えた時や (1..0) のような値が存在しない範囲を渡した時などに発生します。

//emlist[例][ruby]{
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0....
...-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0...
...見える

# 上と同じ種で再初期化
prng = Random.new(1234)
srand(1234)
# Kernel.#rand は Array#sample などの影響を受けて値がずれることがある
[0, 1].sample
prng.rand #=> 0.1915194503788923
rand #=> 0.6221087710398319
//}


@see Kernel.#rand...

Random#rand(max) -> Integer | Float (27.0)

一様な擬似乱数を発生させます。

...に負の数値を与えた時や (1..0) のような値が存在しない範囲を渡した時などに発生します。

//emlist[例][ruby]{
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0....
...-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0...
...見える

# 上と同じ種で再初期化
prng = Random.new(1234)
srand(1234)
# Kernel.#rand は Array#sample などの影響を受けて値がずれることがある
[0, 1].sample
prng.rand #=> 0.1915194503788923
rand #=> 0.6221087710398319
//}


@see Kernel.#rand...

Random#rand(range) -> Integer | Float (27.0)

一様な擬似乱数を発生させます。

...に負の数値を与えた時や (1..0) のような値が存在しない範囲を渡した時などに発生します。

//emlist[例][ruby]{
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0....
...-25 03:11:42 +0900
require 'date'
prng.rand(Date.new(2012, 1, 1) ... Date.new(2013,1,1)) # => #<Date: 2012-01-31 ((2455958j,0s,0n),+0s,2299161j)>
# Kernel.#rand とほぼ同様の使い勝手
prng = Random.new(1234)
prng.rand # => 0.1915194503788923
srand(1234)
rand # => 0...
...見える

# 上と同じ種で再初期化
prng = Random.new(1234)
srand(1234)
# Kernel.#rand は Array#sample などの影響を受けて値がずれることがある
[0, 1].sample
prng.rand #=> 0.1915194503788923
rand #=> 0.6221087710398319
//}


@see Kernel.#rand...

Thread#exit -> self (27.0)

スレッドの実行を終了させます。終了時に ensure 節が実行されます。

...スを Kernel.#exit(0)
により終了します。

Kernel
.#exit と違い例外 SystemExit を発生しません。

th1 = Thread.new do
begin
sleep 10
ensure
p "this will be displayed"
end
end

sleep 0.1
th1.kill

#=> "this will be displayed"

@see Kernel.#exit,...

Thread#kill -> self (27.0)

スレッドの実行を終了させます。終了時に ensure 節が実行されます。

...スを Kernel.#exit(0)
により終了します。

Kernel
.#exit と違い例外 SystemExit を発生しません。

th1 = Thread.new do
begin
sleep 10
ensure
p "this will be displayed"
end
end

sleep 0.1
th1.kill

#=> "this will be displayed"

@see Kernel.#exit,...

絞り込み条件を変える

<< 1 2 3 ... > >>