るりまサーチ

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

別のキーワード

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

ライブラリ

クラス

キーワード

検索結果

BasicObject#! -> bool (18227.0)

オブジェクトを真偽値として評価し、その論理否定を返します。

...unt = 0
end
attr_reader :count

def !
@count += 1
super
end
end

recorder = NegationRecorder.new
!
recorder
!
!!!!!!recorder
puts 'hoge' if !recorder

puts recorder.count #=> 3
//}

//emlist[例][ruby]{
class AnotherFalse < BasicObject
def !
true
end
end
another_false = Anothe...

Delegator#! -> bool (18203.0)

自身を否定します。

自身を否定します。

BasicObject#!=(other) -> bool (6202.0)

オブジェクトが other と等しくないことを判定します。

...返します。
このため、サブクラスで BasicObject#== を再定義しても != とは自動的に整合性が
とれるようになっています。

ただし、 BasicObject#!= 自身や BasicObject#! を再定義した際には、ユーザーの責任で
整合性を保たなくては...
...icObject#==, BasicObject#!

//emlist[例][ruby]{
class NonequalityRecorder < BasicObject
def initialize
@count = 0
end
attr_reader :count

def !=(other)
@count += 1
super
end
end
recorder = NonequalityRecorder.new

recorder != 1
puts 'hoge' if recorder != "str"

p recorder.coun...

Delegator#!=(obj) -> bool (6202.0)

自身が与えられたオブジェクトと等しくない場合は、真を返します。 そうでない場合は、偽を返します。

自身が与えられたオブジェクトと等しくない場合は、真を返します。
そうでない場合は、偽を返します。

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

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

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

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

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

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

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

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

絞り込み条件を変える

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

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

...when /ruby(?!\s*on\s*rails)/i
"hit! #{arg}"
when String
"Instance of 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 wo...