るりまサーチ

最速Rubyリファレンスマニュアル検索!
144件ヒット [101-144件を表示] (0.081秒)
トップページ > クエリ:ruby[x] > クエリ:Ruby[x] > 種類:インスタンスメソッド[x] > クエリ:j[x] > クエリ:class[x] > クラス:BasicObject[x]

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

検索結果

<< < 1 2 >>

BasicObject#singleton_method_added(name) -> object (3120.0)

特異メソッドが追加された時にインタプリタから呼び出されます。

...

//emlist[例][ruby]{
class
Foo
def singleton_method_added(name)
puts "singleton method \"#{name}\" was added"
end
end

obj = Foo.new
def obj.foo
end

#=> singleton method "foo" was added
//}

@see Module#method_added,BasicObject#singleton_method_removed,BasicObject#singleton_method_unde...

BasicObject#! -> bool (3050.0)

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

...メソッドを再定義しても Ruby の制御式において nil や false 以外が偽として
扱われることはありません。

@return オブジェクトが偽であれば真、さもなくば偽

//emlist[例][ruby]{
class
NegationRecorder < BasicObject
def initialize
@count = 0...
...recorder = NegationRecorder.new
!recorder
!!!!!!!recorder
puts 'hoge' if !recorder

puts recorder.count #=> 3
//}

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

# another_falseは*真*
puts "another false is a truth" if another_f...

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

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

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

ただし、 BasicObject#!= 自身や BasicObject#! を再定義した際には、ユーザーの責任で
整合性を...
...義するものと想定されています。

@param other 比較対象となるオブジェクト
@see BasicObject#==, BasicObject#!

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

def !=(other)
@count += 1
super...

BasicObject#==(other) -> bool (3020.0)

オブジェクトが other と等しければ真を、さもなくば偽を返します。

...デフォルトでは Object#equal? と同じオブジェクトの同一性になっています。

@param other 比較対象となるオブジェクト
@return other が self と同値であれば真、さもなくば偽

//emlist[例][ruby]{
class
Person < BasicObject
def initialize(name, age...
...)
@name = name
@age = age
end
end

tanaka1 = Person.new("tanaka", 24)
tanaka2 = Person.new("tanaka", 24)

tanaka1 == tanaka1 #=> true
tanaka1 == tanaka2 #=> false
//}

@see BasicObject#equal?, Object#==, Object#equal?,
Object#eql?...
<< < 1 2 >>