144件ヒット
[101-144件を表示]
(0.046秒)
別のキーワード
ライブラリ
- ビルトイン (144)
キーワード
- ! (12)
- != (12)
- == (12)
-
_ _ send _ _ (24) -
instance
_ eval (24) -
instance
_ exec (12) -
method
_ missing (12) -
singleton
_ method _ added (12) -
singleton
_ method _ removed (12) -
singleton
_ method _ undefined (12)
検索結果
先頭4件
-
BasicObject
# singleton _ method _ undefined(name) -> object (120.0) -
特異メソッドが Module#undef_method または undef により未定義にされた時にインタプリタから呼び出されます。
...メソッド名が Symbol で渡されます。
//emlist[例][ruby]{
class Foo
def singleton_method_undefined(name)
puts "singleton method \"#{name}\" was undefined"
end
end
obj = Foo.new
def obj.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... -
BasicObject
# !=(other) -> bool (114.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 (114.0) -
オブジェクトが other と等しければ真を、さもなくば偽を返します。
...偽
//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#==, O... -
BasicObject
# singleton _ method _ added(name) -> object (114.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...