るりまサーチ (Ruby 2.2.0)

最速Rubyリファレンスマニュアル検索!
5件ヒット [1-5件を表示] (0.019秒)
トップページ > バージョン:2.2.0[x] > ライブラリ:ビルトイン[x] > クエリ:puts[x] > クラス:BasicObject[x]

別のキーワード

  1. _builtin puts
  2. csv puts
  3. stringio puts
  4. io puts
  5. xmp puts

検索結果

BasicObject#! -> bool (64.0)

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

...order < BasicObject
def initialize
@count = 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...

BasicObject#!=(other) -> bool (28.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#singleton_method_added(name) -> object (28.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_undefined...

BasicObject#singleton_method_removed(name) -> object (28.0)

特異メソッドが Module#remove_method に より削除された時にインタプリタから呼び出されます。

...method_removed(name)
puts "singleton method \"#{name}\" was removed"
end
end

obj = Foo.new
def obj.foo
end

class << obj
remove_method :foo
end

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

@see Module#method_removed,BasicObject#singleton_method_added,BasicObject#singleton_method_undefined...

BasicObject#singleton_method_undefined(name) -> object (28.0)

特異メソッドが Module#undef_method または undef により未定義にされた時にインタプリタから呼び出されます。

...foo
end
def obj.bar
end

class << obj
undef_method :foo
end
obj.instance_eval {undef bar}

#=> singleton method "foo" was undefined
# singleton method "bar" was undefined
//}

@see Module#method_undefined,BasicObject#singleton_method_added,BasicObject#singleton_method_removed , d:spec/def#undef...

絞り込み条件を変える