5件ヒット
[1-5件を表示]
(0.052秒)
クラス
-
Psych
:: Nodes :: Document (1) - Struct (4)
検索結果
先頭5件
-
Psych
:: Nodes :: Document . new(version=[] , tag _ directives=[] , implicit=false) -> Psych :: Nodes :: Document (54943.0) -
Document オブジェクトを生成します。
Document オブジェクトを生成します。
version にはドキュメントのバージョンを指定します。
[major, minor] という配列で指定します。
tag_directives には tag directive の配列を指定します。
それぞれの tag は [prefix, suffix] という文字列の配列で
表現します。
implicit にはドキュメントが implicit に始まっているかどうかを
真偽値で指定します。
@param version YAML ドキュメントのバージョン
@param tag_directives tag directive の配列... -
Struct
. new(*args) -> Class (54643.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
Struct クラスに新しいサブクラスを作って、それを返します。
サブクラスでは構造体のメンバに対するアクセスメソッドが定義されています。
//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "name:%s age:%d", fred.name, fred.age
#=> "name:fred age:6" を出力します
//}
実装の都合により、クラス名の省略は後づけの機能でした。
メンバ名に String を指定できるのは後方互換... -
Struct
. new(*args) {|subclass| block } -> Class (54643.0) -
Struct クラスに新しいサブクラスを作って、それを返します。
Struct クラスに新しいサブクラスを作って、それを返します。
サブクラスでは構造体のメンバに対するアクセスメソッドが定義されています。
//emlist[例][ruby]{
dog = Struct.new("Dog", :name, :age)
fred = dog.new("fred", 5)
fred.age = 6
printf "name:%s age:%d", fred.name, fred.age
#=> "name:fred age:6" を出力します
//}
実装の都合により、クラス名の省略は後づけの機能でした。
メンバ名に String を指定できるのは後方互換... -
Struct
. [](*args) -> Struct (54403.0) -
(このメソッドは Struct の下位クラスにのみ定義されています) 構造体オブジェクトを生成して返します。
(このメソッドは Struct の下位クラスにのみ定義されています)
構造体オブジェクトを生成して返します。
@param args 構造体の初期値を指定します。メンバの初期値は指定されなければ nil です。
@return 構造体クラスのインスタンス。
@raise ArgumentError 構造体のメンバの数よりも多くの引数を指定した場合に発生します。
//emlist[例][ruby]{
Foo = Struct.new(:foo, :bar)
foo = Foo.new(1)
p foo.values # => [1, nil]
//} -
Struct
. new(*args) -> Struct (54403.0) -
(このメソッドは Struct の下位クラスにのみ定義されています) 構造体オブジェクトを生成して返します。
(このメソッドは Struct の下位クラスにのみ定義されています)
構造体オブジェクトを生成して返します。
@param args 構造体の初期値を指定します。メンバの初期値は指定されなければ nil です。
@return 構造体クラスのインスタンス。
@raise ArgumentError 構造体のメンバの数よりも多くの引数を指定した場合に発生します。
//emlist[例][ruby]{
Foo = Struct.new(:foo, :bar)
foo = Foo.new(1)
p foo.values # => [1, nil]
//}