40件ヒット
[1-40件を表示]
(0.012秒)
種類
- インスタンスメソッド (36)
- 特異メソッド (4)
ライブラリ
- ビルトイン (40)
キーワード
- == (12)
- eql? (12)
- equal? (12)
-
keyword
_ init? (4)
検索結果
先頭4件
-
Struct
# ==(other) -> bool (102.0) -
self と other のクラスが同じであり、各メンバが == メソッドで比較して等しい場合に true を返します。そうでない場合に false を返します。
...//emlist[例][ruby]{
Dog = Struct.new(:name, :age)
dog1 = Dog.new("fred", 5)
dog2 = Dog.new("fred", 5)
p dog1 == dog2 #=> true
p dog1.eql?(dog2) #=> true
p dog1.equal?(dog2) #=> false
//}
[注意] 本メソッドの記述は Struct の下位クラスのイン......スタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。
@see Struct#eql?... -
Struct
# eql?(other) -> bool (102.0) -
self と other のクラスが同じであり、各メンバが eql? メソッドで比較して等しい場合に true を返します。そうでない場合に false を返します。
...//emlist[例][ruby]{
Dog = Struct.new(:name, :age)
dog1 = Dog.new("fred", 5)
dog2 = Dog.new("fred", 5)
p dog1 == dog2 #=> true
p dog1.eql?(dog2) #=> true
p dog1.equal?(dog2) #=> false
//}
[注意] 本メソッドの記述は Struct の下位クラスのイン......スタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。
@see Struct#==... -
Struct
# equal?(other) -> bool (102.0) -
指定された other が self 自身である場合のみ真を返します。 これは Object クラスで定義されたデフォルトの動作で す。
...たデフォルトの動作で
す。
[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。
@see Struct#eql?, Struct#==... -
Struct
. keyword _ init? -> bool | nil (102.0) -
(このメソッドは Struct の下位クラスにのみ定義されています) 構造体が作成されたときに keyword_init: true を指定されていたら true を返します。 false を指定されていたら false を返します。 それ以外の場合は nil を返します。
...(このメソッドは Struct の下位クラスにのみ定義されています)
構造体が作成されたときに keyword_init: true を指定されていたら true を返します。
false を指定されていたら false を返します。
それ以外の場合は nil を返します。......//emlist[例][ruby]{
Foo = Struct.new(:a)
Foo.keyword_init? # => nil
Bar = Struct.new(:a, keyword_init: true)
Bar.keyword_init? # => true
Baz = Struct.new(:a, keyword_init: false)
Baz.keyword_init? # => false
//}...