るりまサーチ

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

別のキーワード

  1. socket bool
  2. option bool
  3. variant vt_bool
  4. win32ole vt_bool
  5. bool socket

ライブラリ

キーワード

検索結果

<< 1 2 > >>

Object#is_a?(mod) -> bool (104.0)

オブジェクトが指定されたクラス mod かそのサブクラスのインスタンスであるとき真を返します。

...ードしたクラスかそのサブクラス
のインスタンスである場合にも真を返します。
Module#includeだけではなく、Object#extendやModule#prependに
よってサブクラスのインスタンスになる場合も含みます。
上記のいずれでもない場合に fa...
...です。

//emlist[][ruby]{
module M
end
class C < Object
include M
end
class S < C
end

obj = S.new
p obj.is_a?(S) # true
p obj.is_a?(C) # true
p obj.is_a?(Object) # true
p obj.is_a?(M) # true
p obj.is_a?(Hash) # false
//}

@see Object#instance_of?,Module#===,Object#class...

Object#kind_of?(mod) -> bool (104.0)

オブジェクトが指定されたクラス mod かそのサブクラスのインスタンスであるとき真を返します。

...ードしたクラスかそのサブクラス
のインスタンスである場合にも真を返します。
Module#includeだけではなく、Object#extendやModule#prependに
よってサブクラスのインスタンスになる場合も含みます。
上記のいずれでもない場合に fa...
...です。

//emlist[][ruby]{
module M
end
class C < Object
include M
end
class S < C
end

obj = S.new
p obj.is_a?(S) # true
p obj.is_a?(C) # true
p obj.is_a?(Object) # true
p obj.is_a?(M) # true
p obj.is_a?(Hash) # false
//}

@see Object#instance_of?,Module#===,Object#class...

Object#!~(other) -> bool (103.0)

自身が other とマッチしない事を判定します。

自身が other とマッチしない事を判定します。

self#=~(obj) を反転した結果と同じ結果を返します。

@param other 判定するオブジェクトを指定します。

//emlist[例][ruby]{
obj = 'regexp'
p (obj !~ /re/) # => false

obj = nil
p (obj !~ /re/) # => true
//}

Object#==(other) -> bool (103.0)

オブジェクトと other が等しければ真を返します。

...
の同一性判定になっています。

@param other 比較するオブジェクトです。

//emlist[例][ruby]{
o = Object.new
p(o.eql?(o)) #=> true
p(o.eql?(Object.new)) #=> false
//}

下記の例のように、各クラスの性質に合わせて再定義されることが期待され...
...ています。

//emlist[適切に再定義されている例][ruby]{
p("foo" == "bar") #=> false
p("foo" == "foo") #=> true

p(4 == 4) #=> true
p(4 == 4.0) #=> true
//}

@see Object#equal?,Object#eql?...

Object#===(other) -> bool (103.0)

case 式で使用されるメソッドです。d:spec/control#case も参照してください。

...ドは case 式での振る舞いを考慮して、
各クラスの性質に合わせて再定義すべきです。

デフォルトでは内部で Object#== を呼び出します。

when 節の式をレシーバーとして === を呼び出すことに注意してください。

また Enumerable...
...String class. But don't hit."
else
"unknown"
end
end

puts check([]) #=> unknown
puts check("mash-up in Ruby on Rails") #=> instance of String class. But not hit...
puts check("<Ruby's world>") #=> hit! <Ruby's world>
//}

@see Object#==, Range#===, Module#===, Regexp#===, Enumerable#grep...

絞り込み条件を変える

Object#eql?(other) -> bool (103.0)

オブジェクトと other が等しければ真を返します。Hash で二つのキー が等しいかどうかを判定するのに使われます。

... Object#hash メソッ
ドも再定義しなければなりません。

@param other 比較するオブジェクトです。

//emlist[][ruby]{
p("foo".eql?("bar")) #=> false
p("foo".eql?("foo")) #=> true

p(4.eql?(4)) #=> true
p(4.eql?(4.0)) #=> false
//}

@see Object#hash,Object#equal?,Object#==...

Object#equal?(other) -> bool (103.0)

other が self 自身の時、真を返します。

...Object#object_idが一致する
かどうかを調べます。

@param other 比較するオブジェクトです。

//emlist[][ruby]{
p("foo".equal?("bar")) #=> false
p("foo".equal?("foo")) #=> false

p(4.equal?(4)) #=> true
p(4.equal?(4.0)) #=> false

p(:foo.equal? :foo) #=> true
//}

@see Object...
...#object_id,Object#==,Object#eql?,Symbol...

Object#frozen? -> bool (103.0)

オブジェクトが凍結(内容の変更を禁止)されているときに真を返します。

...オブジェクトが凍結(内容の変更を禁止)されているときに真を返します。

//emlist[][ruby]{
obj = "someone"
p obj.frozen? #=> false
obj.freeze
p obj.frozen? #=> true
//}

@see Object#freeze...

Object#instance_of?(klass) -> bool (103.0)

オブジェクトがクラス klass の直接のインスタンスである時真を返します。

...常に obj.kind_of?(c) も成立します。

@param klass Classかそのサブクラスのインスタンスです。

//emlist[][ruby]{
class C < Object
end
class S < C
end

obj = S.new
p obj.instance_of?(S) # true
p obj.instance_of?(C) # false
//}

@see Object#kind_of?,Object#class...
<< 1 2 > >>