るりまサーチ (Ruby 2.5.0)

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

別のキーワード

  1. openssl integer
  2. asn1 integer
  3. _builtin integer
  4. integer chr
  5. integer upto

クラス

キーワード

検索結果

Hash#hash -> Integer (81652.0)

自身が保持するキーと値のハッシュ値を元にして算出した整数を返します。 自身が保持するキーや値が変化すればこのメソッドが返す値も変化します。

自身が保持するキーと値のハッシュ値を元にして算出した整数を返します。
自身が保持するキーや値が変化すればこのメソッドが返す値も変化します。

//emlist[例][ruby]{
a = {}
p a.hash #=> 0
a[1] = :x
p a.hash #=> 329543
//}

Object#hash -> Integer (54916.0)

オブジェクトのハッシュ値を返します。このハッシュ値は、Object#eql? と合わせて Hash クラスで、2つのオブジェクトを同一のキーとするか判定するために用いられます。

オブジェクトのハッシュ値を返します。このハッシュ値は、Object#eql? と合わせて Hash クラスで、2つのオブジェクトを同一のキーとするか判定するために用いられます。

2つのオブジェクトのハッシュ値が異なるとき、直ちに異なるキーとして判定されます。
逆に、2つのハッシュ値が同じとき、さらに Object#eql? での比較により判定されます。
そのため、同じキーとして判定される状況は Object#eql? の比較で真となる場合のみであり、このとき前段階としてハッシュ値どうしが等しい必要があります。
つまり、

A.eql?(B) ならば A.hash == B.hash

...

Array#hash -> Integer (54688.0)

自身のハッシュ値を整数で返します。ハッシュ値は自身の各要素のハッシュ値から 計算されます。Array#eql? で比較して等しい配列同士は同じハッシュ値を返します。

自身のハッシュ値を整数で返します。ハッシュ値は自身の各要素のハッシュ値から
計算されます。Array#eql? で比較して等しい配列同士は同じハッシュ値を返します。

//emlist[例][ruby]{
a = ["a", "b", 1]
a.hash #=> 321
b = a.dup
b.hash #=> 321

["a", 1, "b"].hash #=> 491
["a", 1.0, "b"].hash #=> 466227
//}

String#hash -> Integer (54688.0)

self のハッシュ値を返します。 eql? で等しい文字列は、常にハッシュ値も等しくなります。

self のハッシュ値を返します。
eql? で等しい文字列は、常にハッシュ値も等しくなります。

//emlist[例][ruby]{
"test".hash # => 4038258770210371295
("te" + "st").hash == "test".hash # => true
//}

@see Hash

Float#hash -> Integer (54670.0)

ハッシュ値を返します。

ハッシュ値を返します。

//emlist[例][ruby]{
pi1 = 3.14
pi2 = 3.14
pi3 = 3.1415

pi1.hash # => 335364239
pi2.hash # => 335364239
pi3.hash # => 420540030
//}

絞り込み条件を変える

Method#hash -> Integer (54652.0)

自身のハッシュ値を返します。

自身のハッシュ値を返します。


//emlist[例][ruby]{
a = method(:==)
b = method(:eql?)
p a.eql? b # => true
p a.hash == b.hash # => true
p [a, b].uniq.size # => 1
//}

Range#hash -> Integer (54652.0)

始端と終端のハッシュ値と Range#exclude_end? の値からハッシュ値を計算して整数として返します。

始端と終端のハッシュ値と Range#exclude_end? の値からハッシュ値を計算して整数として返します。

//emlist[例][ruby]{
p (1..2).hash # => 5646
p (1...2).hash # => 16782863
//}

Regexp#hash -> Integer (54652.0)

正規表現のオプションやテキストに基づいたハッシュ値を返します。

正規表現のオプションやテキストに基づいたハッシュ値を返します。

//emlist[例][ruby]{
p /abc/i.hash # => 4893115
p /abc/.hash # => 4856055
//}

Struct#hash -> Integer (54652.0)

self が保持するメンバのハッシュ値を元にして算出した整数を返します。 self が保持するメンバの値が変化すればこのメソッドが返す値も変化します。

self が保持するメンバのハッシュ値を元にして算出した整数を返します。
self が保持するメンバの値が変化すればこのメソッドが返す値も変化します。

//emlist[例][ruby]{
Dog = Struct.new(:name, :age)
dog = Dog.new("fred", 5)
p dog.hash #=> 7917421
dog.name = "john"
p dog.hash #=> -38913223
//}

[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して...

UnboundMethod#hash -> Integer (54652.0)

自身のハッシュ値を返します。

自身のハッシュ値を返します。


//emlist[例][ruby]{
a = method(:==).unbind
b = method(:eql?).unbind
p a.eql? b # => true
p a.hash == b.hash # => true
p [a, b].uniq.size # => 1
//}

絞り込み条件を変える

Rational#hash -> Integer (54634.0)

自身のハッシュ値を返します。

自身のハッシュ値を返します。

@return ハッシュ値を返します。


@see Object#hash

Time#hash -> Integer (54634.0)

self のハッシュ値を返します。

self のハッシュ値を返します。

@return ハッシュ値を返します。


@see Object#hash

MatchData#hash -> Integer (54616.0)

self のマッチ対象になった文字列、元になった正規表現オブジェクト、マッチ した位置を元にハッシュ値を計算して返します。

self のマッチ対象になった文字列、元になった正規表現オブジェクト、マッチ
した位置を元にハッシュ値を計算して返します。

Proc#hash -> Integer (54616.0)

self のハッシュ値を返します。

self のハッシュ値を返します。



Proc オブジェクトの引数の情報を返します。

Proc オブジェクトが引数を取らなければ空の配列を返します。引数を取る場合は、配列の配列を返し、
各配列の要素は引数の種類に対応した以下のような Symbol と、引数名を表す Symbol の 2 要素です。

//emlist[][ruby]{
prc = proc{|x, y=42, *other|}
p prc.parameters # => x], [:opt, :y], [:rest, :other
prc = lambda{|x, y=42, *other|}
p prc.param...

Hash#length -> Integer (27316.0)

ハッシュの要素の数を返します。

ハッシュの要素の数を返します。

//emlist[][ruby]{
h = { "d" => 100, "a" => 200, "v" => 300, "e" => 400 }
h.length #=> 4
h.size #=> 4
h.delete("a") #=> 200
h.length #=> 3
h.size #=> 3
//}

絞り込み条件を変える

Hash#size -> Integer (27316.0)

ハッシュの要素の数を返します。

ハッシュの要素の数を返します。

//emlist[][ruby]{
h = { "d" => 100, "a" => 200, "v" => 300, "e" => 400 }
h.length #=> 4
h.size #=> 4
h.delete("a") #=> 200
h.length #=> 3
h.size #=> 3
//}

Regexp#named_captures -> { String => [Integer] } (397.0)

正規表現に含まれる名前付きキャプチャ(named capture)の情報を Hash で返します。

正規表現に含まれる名前付きキャプチャ(named capture)の情報を
Hash で返します。

Hash のキーは名前付きキャプチャの名前で、値は
その名前に関連付けられたキャプチャの index のリストを返します。

//emlist[例][ruby]{
/(?<foo>.)(?<bar>.)/.named_captures
# => {"foo"=>[1], "bar"=>[2]}

/(?<foo>.)(?<foo>.)/.named_captures
# => {"foo"=>[1, 2]}

# 名前付きキャプチャを持たないときは空の Hash を返します。
/(.)(.)/...

UnboundMethod#owner -> Class | Module (100.0)

このメソッドが定義されている class か module を返します。

このメソッドが定義されている class か module を返します。

//emlist[例][ruby]{
Integer.instance_method(:to_s).owner # => Integer
Integer.instance_method(:to_c).owner # => Numeric
Integer.instance_method(:hash).owner # => Kernel
//}

String#%(args) -> String (64.0)

printf と同じ規則に従って args をフォーマットします。

printf と同じ規則に従って args をフォーマットします。

args が配列であれば Kernel.#sprintf(self, *args) と同じです。
それ以外の場合は Kernel.#sprintf(self, args) と同じです。

@param args フォーマットする値、もしくはその配列
@return フォーマットされた文字列

//emlist[例][ruby]{
p "i = %d" % 10 # => "i = 10"
p "i = %x" % 10 # => "i = a"
p "i = %o" % 10...

Array#dig(idx, ...) -> object | nil (46.0)

self 以下のネストしたオブジェクトを dig メソッドで再帰的に参照して返し ます。途中のオブジェクトが nil であった場合は nil を返します。

self 以下のネストしたオブジェクトを dig メソッドで再帰的に参照して返し
ます。途中のオブジェクトが nil であった場合は nil を返します。

@param idx インデックスを整数で任意個指定します。

//emlist[例][ruby]{
a = [[1, [2, 3]]]

a.dig(0, 1, 1) # => 3
a.dig(1, 2, 3) # => nil
a.dig(0, 0, 0) # => TypeError: Integer does not have #di...

絞り込み条件を変える

Encoding::Converter#primitive_convert(source_buffer, destination_buffer) -> Symbol (46.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset) -> Symbol (46.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize) -> Symbol (46.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@...

Encoding::Converter#primitive_convert(source_buffer, destination_buffer, destination_byteoffset, destination_bytesize, options) -> Symbol (46.0)

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

エンコーディング変換のためのメソッドの中で、もっとも細かな扱いが可能なメソッドです。

可搬性を確保しつつ、不正なバイトや変換先で未定義な文字の扱いを細かに指定したいときは、Encoding::Converter#primitive_convert が唯一の方法になります。

@param source_buffer 変換元文字列のバッファ
@param destination_buffer 変換先文字列を格納するバッファ
@param destination_byteoffset 変換先バッファでのオフセット
@param destination_bytesize 変換先バッファの容量
@...