るりまサーチ (Ruby 2.1.0)

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

別のキーワード

  1. _builtin >
  2. bigdecimal >
  3. module >
  4. comparable >
  5. integer >

クラス

検索結果

Struct#length -> Integer (81700.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 (36400.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
//}