-
Notifications
You must be signed in to change notification settings - Fork 4
class Compound
Daisuke YAMAGUCHI edited this page Nov 1, 2016
·
12 revisions
Siren::Compound とは、すべての Siren::Shape を内包可能なオブジェクトです。Siren::Shape クラスの派生クラスです。Siren::Shape オブジェクトのグループとして用いることができます。
new(shape, ...) -> Compound
new([shape, ...], ...) -> Compound
Siren::Shape 型のオブジェクトを内包する Siren::Compound オブジェクトを生成します。
例) include Siren c1 = Compound.new box c2 = Compound.new box, box c3 = Compound.new [box] c4 = Compound.new [box, box] c5 = Compound.new [box, box], box c6 = Compound.new [box, box], [box, box]
push(shape) -> Compound
<<(shape) -> Compound
Siren::Compound オブジェクトに Siren::Shape オブジェクトを追加します。
delete(shape) -> Compound
Siren::Compound オブジェクトに内包される Siren::Shape オブジェクトを削除します。
例) include Siren mybox = box mycomp = Compound.new mybox p mycomp.subshapes.size # => 1 mycomp.delete mybox p mycomp.subshapes.size # => 0
目的に応じ、次のメソッドを利用します。