144件ヒット
[101-144件を表示]
(0.154秒)
ライブラリ
- ビルトイン (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
# ==(other) -> bool (3114.0) -
オブジェクトが other と等しければ真を、さもなくば偽を返します。
...オブジェクトが other と等しければ真を、さもなくば偽を返します。
このメソッドは各クラスの性質に合わせて、サブクラスで再定義するべきです。
多くの場合、オブジェクトの内容が等しければ真を返すように (同値性を......ォルトでは Object#equal? と同じオブジェクトの同一性になっています。
@param other 比較対象となるオブジェクト
@return other が self と同値であれば真、さもなくば偽
//emlist[例][ruby]{
class Person < BasicObject
def initialize(name, age)
@n......ame = 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?... -
BasicObject
# _ _ send _ _ (name , *args) -> object (3114.0) -
オブジェクトのメソッド name を args を引数にして呼び出し、メソッドの結果を返します。
...引数
//emlist[例][ruby]{
class Mail
def delete(*args)
"(Mail#delete) - delete " + args.join(',')
end
def send(name, *args)
"(Mail#send) - #{name} #{args.join(',')}"
end
end
mail = Mail.new
mail.send :delete, "gentle", "readers" # => "(Mail#send) - delete gentle,readers"
mai......l.__send__ :delete, "gentle", "readers" # => "(Mail#delete) - delete gentle,readers"
//}
@see Object#send... -
BasicObject
# _ _ send _ _ (name , *args) { . . . . } -> object (3114.0) -
オブジェクトのメソッド name を args を引数にして呼び出し、メソッドの結果を返します。
...引数
//emlist[例][ruby]{
class Mail
def delete(*args)
"(Mail#delete) - delete " + args.join(',')
end
def send(name, *args)
"(Mail#send) - #{name} #{args.join(',')}"
end
end
mail = Mail.new
mail.send :delete, "gentle", "readers" # => "(Mail#send) - delete gentle,readers"
mai......l.__send__ :delete, "gentle", "readers" # => "(Mail#delete) - delete gentle,readers"
//}
@see Object#send... -
BasicObject
# ! -> bool (3032.0) -
オブジェクトを真偽値として評価し、その論理否定を返します。
...も Ruby の制御式において nil や false 以外が偽として
扱われることはありません。
@return オブジェクトが偽であれば真、さもなくば偽
//emlist[例][ruby]{
class NegationRecorder < BasicObject
def initialize
@count = 0
end
attr_reader :count......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 = AnotherFalse.new
# another_falseは*真*
puts "another......false is a truth" if another_false
#=> "another false is a truth"
//}...