るりまサーチ

最速Rubyリファレンスマニュアル検索!
327件ヒット [101-200件を表示] (0.029秒)
トップページ > クラス:Struct[x] > クエリ:struct[x] > クエリ:new[x]

別のキーワード

  1. mkmf have_struct_member
  2. struct []
  3. struct each
  4. struct select

ライブラリ

キーワード

検索結果

<< < 1 2 3 4 > >>

Struct#inspect -> String (9049.0)

self の内容を人間に読みやすい文字列にして返します。

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

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

Struct#to_s -> String (9049.0)

self の内容を人間に読みやすい文字列にして返します。

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

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

Struct#[]=(member, value) (9043.0)

構造体の member で指定されたメンバの値を value にして value を返します。

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

//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith...

Struct#each -> Enumerator (9043.0)

構造体の各メンバに対して繰り返します。

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

//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith...

Struct#each {|value| ... } -> self (9043.0)

構造体の各メンバに対して繰り返します。

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

//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith...

絞り込み条件を変える

Struct#each_pair -> Enumerator (9043.0)

構造体のメンバ名(Symbol)と値の組を引数にブロックを繰り返し実行します。

...[ruby]{
Foo = Struct.new(:foo, :bar)
Foo.new('FOO', 'BAR').each_pair {|m, v| p [m,v]}
# => [:foo, "FOO"]
# [:bar, "BAR"]
//}

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

Struct#each_pair {|member, value| ... } -> self (9043.0)

構造体のメンバ名(Symbol)と値の組を引数にブロックを繰り返し実行します。

...[ruby]{
Foo = Struct.new(:foo, :bar)
Foo.new('FOO', 'BAR').each_pair {|m, v| p [m,v]}
# => [:foo, "FOO"]
# [:bar, "BAR"]
//}

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

Struct#filter -> Enumerator (9043.0)

構造体のメンバの値に対してブロックを評価した値が真であった要素を全て含 む配列を返します。真になる要素がひとつもなかった場合は空の配列を返しま す。

...Lots = Struct.new(:a, :b, :c, :d, :e, :f)
l = Lots.new(11, 22, 33, 44, 55, 66)
l.select {|v| (v % 2).zero? } #=> [22, 44, 66]
//}

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

Struct#filter {|i| ... } -> [object] (9043.0)

構造体のメンバの値に対してブロックを評価した値が真であった要素を全て含 む配列を返します。真になる要素がひとつもなかった場合は空の配列を返しま す。

...Lots = Struct.new(:a, :b, :c, :d, :e, :f)
l = Lots.new(11, 22, 33, 44, 55, 66)
l.select {|v| (v % 2).zero? } #=> [22, 44, 66]
//}

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

Struct#hash -> Integer (9043.0)

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 の下位クラスを作成する点に
注意してください。...

絞り込み条件を変える

Struct#length -> Integer (9043.0)

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

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

//emlist[例][ruby]{
Customer = Struct.new(:name, :address, :zip)
joe = Customer.new("Joe Smith...
<< < 1 2 3 4 > >>