るりまサーチ

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

別のキーワード

  1. _builtin to_a
  2. matrix to_a
  3. to_a
  4. dbm to_a
  5. argf.class to_a

ライブラリ

クラス

キーワード

検索結果

Range#eql?(other) -> bool (24117.0)

指定された other が Range クラスのインスタンスであり、 始端と終端が eql? メソッドで比較して等しく、Range#exclude_end? が同じ場合に true を返します。そうでない場合に false を返します。

...指定された other が Range クラスのインスタンスであり、
始端と終端が eql? メソッドで比較して等しく、Range#exclude_end? が同じ場合に
true を返します。そうでない場合に false を返します。

@param other 自身と比較したいオブジェ...
...クトを指定します。

//emlist[例][ruby]{
p (1..2).eql?(1..2) # => true
p (1..2).eql?(1...2) # => false
p (1..2).eql?(Range.new(1.0, 2.0)) # => false
//}...

Pathname#eql?(other) -> bool (21101.0)

パス名を比較し、 other と同じなら真を返します。大文字小文字は区別されます。 other は Pathname オブジェクトでなければなりません。

...other は Pathname オブジェクトでなければなりません。

パス名の比較は単純にパス文字列の比較によって行われるので、論理的に
同じパスでもパス文字列が違えば異なると判断されます。

@param other 比較対象の Pathname オブジ...
...ェクトを指定します。

//emlist[例][ruby]{
require 'pathname'

p Pathname.new("foo/bar") == Pathname.new("foo/bar")
p Pathname.new("foo/bar") == Pathname.new("foo//bar")
p Pathname.new("foo/../foo/bar") == Pathname.new("foo/bar")

# => true
# false
# false
//}...

UnboundMethod#eql?(other) -> bool (18119.0)

自身と other が同じクラスあるいは同じモジュールの同じメソッドを表す場合に true を返します。そうでない場合に false を返します。

...場合に false を返します。

@param other 自身と比較したいオブジェクトを指定します。

//emlist[例][ruby]{
a
= String.instance_method(:size)
b = String.instance_method(:size)
p a == b #=> true

c = Array.instance_method(:size)
p a == c...
...#=> false
//}...

UnboundMethod#hash -> Integer (9231.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
//}...

Hash#assoc(key) -> Array | nil (9219.0)

ハッシュが key をキーとして持つとき、見つかった要素のキーと値のペア を配列として返します。

...性判定には eql? メソッドではなく == メソッドを使います。
key が見つからなかった場合は、nil を返します。

@param key 検索するキー

//emlist[例][ruby]{
h = {"colors" => ["red", "blue", "green"],
"letters" => ["a", "b", "c" ]}
h.assoc("letters") #...
...=> ["letters", ["a", "b", "c"]]
h.assoc("foo") #=> nil
//}



@see Array#assoc...

絞り込み条件を変える

String#hash -> Integer (9217.0)

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

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

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

@see Hash...

Method#hash -> Integer (6231.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
//}...