るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

ライブラリ

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

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

差を計算します。

...差を計算します。

@param other 自身から引く数

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

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

Float#-(other) -> Float (29207.0)

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

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

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

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

Time#-(time) -> Float (26238.0)

自身と time との時刻の差を Float で返します。単位は秒です。

...の差を Float で返します。単位は秒です。

@param time 自身との差を算出したい Time オブジェクトを指定します。

//emlist[][ruby]{
p t = Time.local(2000) # => 2000-01-01 00:00:00 +0900
p t2 = t + 2592000 # => 2000-01-31 00:00:00 +0900
p t2 - t...

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

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

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

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

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

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

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

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

絞り込み条件を変える

Array#at(nth) -> object | nil (23212.0)

nth 番目の要素を返します。nth 番目の要素が存在しない時には nil を返します。

...要素が 0 番目になります。nth の値が負の時には末尾から
のインデックスと見倣します。末尾の要素が -1 番目になります。
整数以外のオブジェクトを指定した場合は to_int メソッドによる
暗黙の型...
...みます。

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

//emlist[例][ruby]{
a = [ "a", "b", "c", "d", "e" ]
a[0] #=> "a"
a[1] #=> "b"
a[-1] #=> "e"
a[-2] #=> "d"
a[10] #=> nil
//}...

Array#repeated_combination(n) -> Enumerator (20401.0)

サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。

...得られる組み合わせの順序は保証されません。ブロックなしで呼び出されると、
組み合わせを生成する Enumerator オブジェクトを返します。

@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェ...
...epeated_combination(1).to_a #=> [[1], [2], [3]]
a.repeated_combination(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
a.repeated_combinatio...
...3,3]]
a.repeated_combination(0).to_a #=> [[]] # one combination of length 0
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.repeated_combination(3) {|e|...

Array#repeated_permutation(n) -> Enumerator (20401.0)

サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。

...実行します。

得られる順列の順序は保証されません。ブロックなしで呼び出されると, 順列
を生成する Enumerator オブジェクトを返します。

@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェ...
...eated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation(0).to_a #=> [[]] # one permutati...
...ロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
//}

@see Array#repeated_combination, Array#permutation...

Array#repeated_combination(n) { |c| ... } -> self (20301.0)

サイズ n の重複組み合わせをすべて生成し、それを引数としてブロックを実行 します。

...得られる組み合わせの順序は保証されません。ブロックなしで呼び出されると、
組み合わせを生成する Enumerator オブジェクトを返します。

@param n 生成される配列のサイズを整数で指定します。
整数以外のオブジェ...
...epeated_combination(1).to_a #=> [[1], [2], [3]]
a.repeated_combination(2).to_a #=> [[1,1],[1,2],[1,3],[2,2],[2,3],[3,3]]
a.repeated_combination(3).to_a #=> [[1,1,1],[1,1,2],[1,1,3],[1,2,2],[1,2,3],
# [1,3,3],[2,2,2],[2,2,3],[2,3,3],[3,3,3]]
a.repeated_combinatio...
...3,3]]
a.repeated_combination(0).to_a #=> [[]] # one combination of length 0
//}

ブロックが与えられた場合、作成した配列の各要素を引数としてブロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2, 3]
result = []
a.repeated_combination(3) {|e|...

Array#repeated_permutation(n) { |p| ... } -> self (20301.0)

サイズ n の重複順列をすべて生成し,それを引数としてブロックを実行します。

...実行します。

得られる順列の順序は保証されません。ブロックなしで呼び出されると, 順列
を生成する Enumerator オブジェクトを返します。

@param n 生成する配列のサイズを整数で指定します。
整数以外のオブジェ...
...eated_permutation(1).to_a #=> [[1], [2]]
a.repeated_permutation(2).to_a #=> [[1,1],[1,2],[2,1],[2,2]]
a.repeated_permutation(3).to_a #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
a.repeated_permutation(0).to_a #=> [[]] # one permutati...
...ロックを実
行して self を返します。

//emlist[例][ruby]{
a = [1, 2]
result = []
a.repeated_permutation(3) {|e| result << e} # => [1,2]
result #=> [[1,1,1],[1,1,2],[1,2,1],[1,2,2],
# [2,1,1],[2,1,2],[2,2,1],[2,2,2]]
//}

@see Array#repeated_combination, Array#permutation...

絞り込み条件を変える

MatchData#values_at(*index) -> [String] (20256.0)

正規表現中の n 番目の括弧にマッチした部分文字列の配列を返します。

...]{
m = /(foo)(bar)(baz)/.match("foobarbaz")
# same as m.to_a.values_at(...)
p m.values_at(0, 1, 2, 3, 4) # => ["foobarbaz", "foo", "bar", "baz", nil]
p m.values_at(-1, -2, -3, -4, -5) # => ["baz", "bar", "foo", nil, nil]

m = /(?<a>\d+) *(?<op>[+\-*\/]) *(?<b>\d+)/.match("1 + 2")
m.to_a...
...# => ["1 + 2", "1", "+", "2"]
m.values_at(:a, :b, :op) # => ["1", "2", "+"]
//}

@see Array#values_at, Array#[]...
<< 1 2 3 ... > >>