class FoodBox(*food { .all { .respond_to(:eat) } }) { } class Fruit { method eat { ... } } class Apple < Fruit { } say FoodBox(Fruit(), Apple()).dump #=> FoodBox(food: [Fruit(), Apple()]) say FoodBox(Apple(), "foo") #!> ERROR: class `FoodBox` !~ (Apple, String)
Last updated 1 year ago