るりまサーチ

最速Rubyリファレンスマニュアル検索!
33件ヒット [1-33件を表示] (0.193秒)
トップページ > クエリ:-[x] > クエリ:E[x] > クエリ:int[x] > クラス:Struct[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method new
  4. irb/input-method gets
  5. matrix -

ライブラリ

キーワード

検索結果

Struct#length -> Integer (6301.0)

構造体のメンバの数を返します。

...記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith",...
..."123 Maple, Anytown NC", 12345)
joe.length #=> 3
//}...

Struct#size -> Integer (6301.0)

構造体のメンバの数を返します。

...記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意してください。

//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith",...
..."123 Maple, Anytown NC", 12345)
joe.length #=> 3
//}...

Struct#hash -> Integer (307.0)

self が保持するメンバのハッシュ値を元にして算出した整数を返します。 self が保持するメンバの値が変化すればこのメソッドが返す値も変化します。

...self が保持するメンバのハッシュ値を元にして算出した整数を返します。
self が保持するメンバの値が変化すればこのメソッドが返す値も変化します。

//emlist[例][ruby]{
Dog = Struct.new(:name, :age)
dog = Dog.new("fred", 5)
p dog.hash...
...#=> 7917421
dog.name = "john"
p dog.hash #=> -38913223
//}

[注意] 本メソッドの記述は Struct の下位クラスのインスタンスに対して呼び
出す事を想定しています。Struct.new は Struct の下位クラスを作成する点に
注意し...