るりまサーチ

最速Rubyリファレンスマニュアル検索!
10007件ヒット [1-100件を表示] (0.157秒)
トップページ > クエリ:-[x] > クエリ:r[x] > クエリ:h[x] > ライブラリ:ビルトイン[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

モジュール

オブジェクト

キーワード

検索結果

<< 1 2 3 ... > >>

Rational#-(other) -> Rational | Float (21332.0)

差を計算します。

...差を計算します。

@param other 自身から引く数

other に Float を指定した場合は、計算結果を Float で返しま
す。

//emlist[例][ruby]{
r
= Rational(3, 4)
r
- 1 # => (-1/4)
r
- 0.5 # => 0.25
//}...

Array#-(other) -> Array (21314.0)

自身から other の要素を取り除いた配列を生成して返します。

...自身から other の要素を取り除いた配列を生成して返します。

要素の同一性は Object#eql? により評価されます。
self 中で重複していて、other中に存在していなかった要素は、その重複が保持されます。

@param other 自身から取...
...場合は to_ary メソッドによ
る暗黙の型変換を試みます。

@raise TypeError 引数に配列以外の(暗黙の型変換が行えない)オブジェクトを
指定した場合に発生します。

//emlist[例][ruby]{
[1, 2, 1, 3, 1, 4] - [4, 2] #...
...=> [1, 1, 3, 1]

[1, 2, 1, 3, 1, 4] - [1, 4] # => [2, 3]
//}...
...=> [1, 1, 3, 1]

[1, 2, 1, 3, 1, 4] - [1, 4] # => [2, 3]
//}


@see Array#difference...

Integer#-(other) -> Numeric (21308.0)

算術演算子。差を計算します。

...算術演算子。差を計算します。

@param other 二項演算の右側の引数(対象)
@return 計算結果

//emlist[][ruby]{
4 - 1 #=> 3
//}...

Complex#-(other) -> Complex (18314.0)

差を計算します。

...差を計算します。

@param other 自身から引く数

//emlist[例][ruby]{
Complex(1, 2) - Complex(2, 3) # => (-1-1i)
//}...

Thread#thread_variable_get(key) -> object | nil (18314.0)

引数 key で指定した名前のスレッドローカル変数を返します。

...意]: Thread#[] でセットしたローカル変数(Fiber ローカル変数)と
異なり、Fiber を切り替えても同じ変数を返す事に注意してください。

例:

Thread.new {
Thread.current.thread_variable_set("foo", "bar") # スレッドローカル
Thread.current["f...
...oo"] = "bar" # Fiber ローカル

Fiber.new {
Fiber.yield [
Thread.current.thread_variable_get("foo"), # スレッドローカル
Thread.current["foo"], # Fiber ローカル
]
}.resume
}.join.value # => ['bar', nil]

...
...の例の "bar" は Thread#thread_variable_get により得られ
た値で、nil はThread#[] により得られた値です。

@see Thread#thread_variable_set, Thread#[]

@see https://magazine.rubyist.net/articles/0041/0041-200Special-note.html...

絞り込み条件を変える

Float#-(other) -> Float (18308.0)

算術演算子。差を計算します。

...算術演算子。差を計算します。

@param other 二項演算の右側の引数(対象)

//emlist[例][ruby]{
# 差
4.5 - 1.3 # => 3.2
//}...

Bignum#-(other) -> Fixnum | Bignum | Float (18302.0)

算術演算子。差を計算します。

...算術演算子。差を計算します。

@param other 二項演算の右側の引数(対象)
@return 計算結果...

Fixnum#-(other) -> Fixnum | Bignum | Float (18302.0)

算術演算子。差を計算します。

...算術演算子。差を計算します。

@param other 二項演算の右側の引数(対象)
@return 計算結果...

Thread#thread_variable?(key) -> bool (18302.0)

引数 key で指定した名前のスレッドローカル変数が存在する場合に true、そ うでない場合に false を返します。

...に true、そ
うでない場合に false を返します。

@param key 変数名を String か Symbol で指定します。

me = Thread.current
me.thread_variable_set(:oliver, "a")
me.thread_variable?(:oliver) # => true
me.thread_variable?(:stanley) # => false

[注意]: Thread#...
...[] でセットしたローカル変数(Fiber ローカル変数)が
対象ではない事に注意してください。

@see Thread#thread_variable_get, Thread#[]...

Thread::MUTEX_FOR_THREAD_EXCLUSIVE -> Mutex (18302.0)

Thread.exclusive用のMutexオブジェクトです。 (private constant です。)

...Thread.exclusive用のMutexオブジェクトです。...
...Thread.exclusive用のMutexオブジェクトです。
(private constant です。)...

絞り込み条件を変える

Enumerable#each_with_index(*args) -> Enumerator (15402.0)

要素とそのインデックスをブロックに渡して繰り返します。

...り返すような
Enumerator を返します。

Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。

@param args イテレータメソッド (each など) にそのまま...
...

//emlist[例][ruby]{
[5, 10, 15].each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}

//emlist[引数ありの例][ruby]{
r
equire 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz"...
..., 2]
//}

@see Enumerator#with_index...

Enumerable#each_with_index(*args) {|item, index| ... } -> self (15402.0)

要素とそのインデックスをブロックに渡して繰り返します。

...り返すような
Enumerator を返します。

Enumerator#with_index は offset 引数を受け取りますが、
each_with_index は受け取りません (引数はイテレータメソッドにそのまま渡されます)。

@param args イテレータメソッド (each など) にそのまま...
...

//emlist[例][ruby]{
[5, 10, 15].each_with_index do |n, idx|
p [n, idx]
end
# => [5, 0]
# [10, 1]
# [15, 2]
//}

//emlist[引数ありの例][ruby]{
r
equire 'stringio'
StringIO.new("foo|bar|baz").each_with_index("|") do |s, i|
p [s, i]
end
# => ["foo|", 0]
# ["bar|", 1]
# ["baz"...
..., 2]
//}

@see Enumerator#with_index...
<< 1 2 3 ... > >>