docs/data_and_struct.md in rbs-3.3.2 vs docs/data_and_struct.md in rbs-3.4.0.pre.1

- old
+ new

@@ -53,5 +53,34 @@ ```ruby Measure.ancestors #=> [Measure, #<Class:0xOOF>, Data, ...] ``` [^1]: [Shannon Skipper](https://github.com/havenwood) told me it in Discord + +## Generate prototype for `Data` and `Struct` + +RBS prototypes for classes using `Data` and `Struct` can be generated by `rbs prototype runtime`. + +```rb +# t.rb +class Measure < Data.define(:amount, :unit) +end +``` + +``` +$ bundle exec rbs prototype runtime -R t.rb Measure +class Measure < ::Data + def self.new: (untyped amount, untyped unit) -> instance + | (amount: untyped, unit: untyped) -> instance + + def self.[]: (untyped amount, untyped unit) -> instance + | (amount: untyped, unit: untyped) -> instance + + def self.members: () -> [ :amount, :unit ] + + def members: () -> [ :amount, :unit ] + + attr_reader amount: untyped + + attr_reader unit: untyped +end +```