るりまサーチ

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

別のキーワード

  1. kernel $-l
  2. matrix l
  3. _builtin $-l
  4. lupdecomposition l
  5. l matrix

ライブラリ

キーワード

検索結果

<< 1 2 3 > >>

Kernel.#Integer(arg, base = 0, exception: true) -> Integer | nil (21460.0)

引数を整数 に変換した結果を返します。

...、0o (8 進数)、0d (10 進数)、0x (16 進
数) です。

@param exception false を指定すると、変換できなかった場合、
例外を発生する代わりに nil を返します。

@raise ArgumentError 整数と見なせない文字列を引数に指定...
...Integerのサブクラス)を返さなかった場合に発生します。
@raise TypeError 引数に nil を指定した場合に発生します。

//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9

p Integer(nil) # can't convert nil...
...into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)

p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p Integer("010") #=> 8
p Integer("0o10") #=> 8
p Integer("0x10") #=> 16
p Integer("0b10") #=> 2
p I...

Kernel.#Integer(arg, base = 0) -> Integer (21360.0)

引数を整数 (Fixnum,Bignum) に変換した結果を返します。

...Integerのサブクラス)を返さなかった場合に発生します。
@raise TypeError 引数に nil を指定した場合に発生します。

//emlist[例][ruby]{
p Integer(4) #=> 4
p Integer(4_000) #=> 4000
p Integer(9.88) #=> 9

p Integer(nil) # can't convert nil...
...into Integer (TypeError)
p Integer(Object.new) # cannot convert Object into Integer (TypeError)

p Integer("10") #=> 10
p Integer("10", 2) #=> 2
p Integer("0d10") #=> 10
p Integer("010") #=> 8
p Integer("0o10") #=> 8
p Integer("0x10") #=> 16
p Integer("0b10") #=> 2
p I...
...尾の空白類は無視される
p Integer("1\n0") # `Integer': invalid value for Integer: "1\n0" (ArgumentError)
p Integer("hoge") # `Integer': invalid value for Integer: "hoge" (ArgumentError)
p Integer("") # `Integer': invalid value for Integer: "" (ArgumentError)
//}

@see Strin...

Kernel.#sleep -> Integer (6204.0)

sec 秒だけプログラムの実行を停止します。

...他スレッドからの Thread#run
などで明示的に起こさない限り永久にスリープします。Thread#runを呼ぶとその時点で
sleepの実行が中断されます。

@param sec 停止する秒数を非負の数値で指定します。浮動小数点数も指定できます。...
...省略された場合、永久にスリープします。

@return 実際に停止していた秒数 (整数に丸められた値) です。

//emlist[例][ruby]{
it = Thread.new do
sleep
puts 'it_end'
end

re = sleep 2.11
puts re
it.run
re2 = sleep 0.76
puts re2
#=> 2
# it_end
# 1
//}...

Kernel.#sleep(sec) -> Integer (6204.0)

sec 秒だけプログラムの実行を停止します。

...他スレッドからの Thread#run
などで明示的に起こさない限り永久にスリープします。Thread#runを呼ぶとその時点で
sleepの実行が中断されます。

@param sec 停止する秒数を非負の数値で指定します。浮動小数点数も指定できます。...
...省略された場合、永久にスリープします。

@return 実際に停止していた秒数 (整数に丸められた値) です。

//emlist[例][ruby]{
it = Thread.new do
sleep
puts 'it_end'
end

re = sleep 2.11
puts re
it.run
re2 = sleep 0.76
puts re2
#=> 2
# it_end
# 1
//}...

Kernel.#syscall(num, *arg) -> Integer (6203.0)

numで指定された番号のシステムコールを実行します。 第2引数以降をシステムコールの引数として渡します。

...syscall(2) や
/usr/include/sys/syscall.h を参照してください。

システムコールの慣習に従い、syscall(2)
が -1 を返す場合には例外 Errno::EXXX が発生します。
それ以外では、返した値をそのまま数値で返します。

ライブラリ fiddle を使...
...ll(2) が -1 を返した場合に発生します。
@raise NotImplementedError 実行環境がこのメソッドに対応していないとき発生します。

//emlist[例][ruby]{
syscall 4, 1, "hello\n", 6 # '4' is write(2) on our box
# => hello
//}

@see fiddle, syscall(2freebsd), syscall(2l...

絞り込み条件を変える

Kernel.#BigDecimal(s) -> BigDecimal (6108.0)

引数で指定した値を表す BigDecimal オブジェクトを生成します。

...引数で指定した値を表す BigDecimal オブジェクトを生成します。

@param s 数値を表現する初期値を文字列、Integer
Float、Rational、BigDecimal オブジェクトのい
ずれかで指定します。
文字列中のスペースは無...
...な有効桁数(self の最大有効桁数)を整数で指定します。 n が
0 または省略されたときは、n の値は s の有効桁数とみなされます。
s の有効桁数より n が小さいときもn = 0 のときと同じです。
self の最大有効...
...以下のような割り算を実行するとき等に意味を持ちます。
//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1") / BigDecimal("3") # => 0.333333333333333333e0
BigDecimal("1",10) / BigDecimal("3",10) # => 0.333333333333333333e0
//}
ただし、個々の演算にお...

Kernel.#BigDecimal(s, exception: true) -> BigDecimal | nil (6108.0)

引数で指定した値を表す BigDecimal オブジェクトを生成します。

...引数で指定した値を表す BigDecimal オブジェクトを生成します。

@param s 数値を表現する初期値を文字列、Integer
Float、Rational、BigDecimal オブジェクトのい
ずれかで指定します。
文字列中のスペースは無...
...な有効桁数(self の最大有効桁数)を整数で指定します。 n が
0 または省略されたときは、n の値は s の有効桁数とみなされます。
s の有効桁数より n が小さいときもn = 0 のときと同じです。
self の最大有効...
...以下のような割り算を実行するとき等に意味を持ちます。
//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1") / BigDecimal("3") # => 0.333333333333333333e0
BigDecimal("1",10) / BigDecimal("3",10) # => 0.333333333333333333e0
//}
ただし、個々の演算にお...

Kernel.#BigDecimal(s, n) -> BigDecimal (6108.0)

引数で指定した値を表す BigDecimal オブジェクトを生成します。

...引数で指定した値を表す BigDecimal オブジェクトを生成します。

@param s 数値を表現する初期値を文字列、Integer
Float、Rational、BigDecimal オブジェクトのい
ずれかで指定します。
文字列中のスペースは無...
...な有効桁数(self の最大有効桁数)を整数で指定します。 n が
0 または省略されたときは、n の値は s の有効桁数とみなされます。
s の有効桁数より n が小さいときもn = 0 のときと同じです。
self の最大有効...
...以下のような割り算を実行するとき等に意味を持ちます。
//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1") / BigDecimal("3") # => 0.333333333333333333e0
BigDecimal("1",10) / BigDecimal("3",10) # => 0.333333333333333333e0
//}
ただし、個々の演算にお...

Kernel.#BigDecimal(s, n, exception: true) -> BigDecimal | nil (6108.0)

引数で指定した値を表す BigDecimal オブジェクトを生成します。

...引数で指定した値を表す BigDecimal オブジェクトを生成します。

@param s 数値を表現する初期値を文字列、Integer
Float、Rational、BigDecimal オブジェクトのい
ずれかで指定します。
文字列中のスペースは無...
...な有効桁数(self の最大有効桁数)を整数で指定します。 n が
0 または省略されたときは、n の値は s の有効桁数とみなされます。
s の有効桁数より n が小さいときもn = 0 のときと同じです。
self の最大有効...
...以下のような割り算を実行するとき等に意味を持ちます。
//emlist[][ruby]{
require "bigdecimal"
BigDecimal("1") / BigDecimal("3") # => 0.333333333333333333e0
BigDecimal("1",10) / BigDecimal("3",10) # => 0.333333333333333333e0
//}
ただし、個々の演算にお...

Kernel.#Rational(x, y = 1) -> Rational (6108.0)

引数を有理数(Rational)に変換した結果を返します。

...引数を有理数(Rational)に変換した結果を返します。

@param x 変換対象のオブジェクトです。

@param y 変換対象のオブジェクトです。省略した場合は x だけを用いて
Rational オブジェクトを作成します。


@raise ArgumentError...
...y した Rational オブジェクトを
返します。

//emlist[例][ruby]{
Rational("1/3") # => (1/3)
Rational(1, 3) # => (1/3)
Rational("0.1", "0.3") # => (1/3)
Rational(Complex(1,2), 2) # => ((1/2)+(1/1)*i)
//}

ただし、1.8系とは異なり、Rational オブジェ...
...クトは常に既約(それ以上
約分できない状態)である事に注意してください。

//emlist[例][ruby]{
Rational(2, 6) # => (1/3)
Rational(1, 3) * 3 # => (1/1)
//}

引数に文字列を指定する場合、以下のいずれかの形式で指定します。

* "1/3...

絞り込み条件を変える

Kernel.#Rational(x, y = 1, exception: true) -> Rational | nil (6108.0)

引数を有理数(Rational)に変換した結果を返します。

...理数(Rational)に変換した結果を返します。

@param x 変換対象のオブジェクトです。

@param y 変換対象のオブジェクトです。省略した場合は x だけを用いて
Rational オブジェクトを作成します。

@param exception false を指定す...
...nil を返します。

@raise ArgumentError 変換できないオブジェクトを指定した場合に発生します。

引数 x、y の両方を指定した場合、x/y した Rational オブジェクトを
返します。

//emlist[例][ruby]{
Rational("1/3") # => (1/3)
Rational(1,...
...(1/3)
Rational("0.1", "0.3") # => (1/3)
Rational(Complex(1,2), 2) # => ((1/2)+(1/1)*i)
//}

ただし、1.8系とは異なり、Rational オブジェクトは常に既約(それ以上
約分できない状態)である事に注意してください。

//emlist[例][ruby]{
Rational(2, 6)...

Kernel.#test(cmd, file) -> bool | Time | Integer | nil (3215.0)

単体のファイルでファイルテストを行います。

...いは同じ文字を表す数値
です。文字列の場合はその先頭の文字だけをコマンドとみなします。
@param file テストするファイルのパスを表す文字列か IO オブジェクトを指定します。
@return 下表に特に明記していないも...
...ァイルサイズが 0 でない (ファイルサイズを返す、0 ならば nil) -> Integer|nil
: ?f
ファイルはプレーンファイルである
: ?d
ファイルはディレクトリである
: ?l
ファイルはシンボリックリンクである
: ?p
ファイルは名...
...me
: ?A
ファイルの最終アクセス時刻を返す -> Time
: ?C
ファイルの inode 変更時刻を返す -> Time

//emlist[例][ruby]{
IO.write("testfile", "test")
test("r", "testfile") # => true
test("s", "testfile") # => 4
test("M", "testfile") # => 2018-03-31 07:38:40 +0900
//}...

Kernel.#test(cmd, file1, file2) -> bool (3205.0)

2ファイル間のファイルテストを行います。

...字列の場合はその先頭の文字だけをコマンドとみなします。
@param file1 テストするファイルのパスを表す文字列か IO オブジェクトを指定します。
@param file2 テストするファイルのパスを表す文字列か IO オブジェクトを指定し...
...イル1とファイル2が同一のファイルである

//emlist[例][ruby]{
IO.write("testfile1", "test1")
IO.write("testfile2", "test2")
%w(= < > -).each do |e|
result = test(e, "testfile1", "testfile2")
puts "#{e}: #{result}"
end
//}

# => =: true
# => <: false
# => >: false
# => -: false...
<< 1 2 3 > >>