README.md in shale-builder-0.1.3 vs README.md in shale-builder-0.1.9

- old
+ new

@@ -1,9 +1,12 @@ # Shale::Builder This addon to the [shale](https://github.com/kgiszczak/shale) Ruby gem adds a simple yet powerful builder DSL. +It also adds support for sorbet and tapioca in shale. +This gem includes a custom tapioca DSL compiler designed for shale. + ## Installation Install the gem and add to the application's Gemfile by executing: $ bundle add shale-builder @@ -46,11 +49,15 @@ class Amount < Shale::Mapper include Shale::Builder attribute :value, Shale::Type::Float - attribute :currency, Shale::Type::String + attribute :currency, Shale::Type::String, doc: <<~DOC + This is some custom documentation that can be used by sorbet. + It will be used by the tapioca DSL compiler + to generate the RBI documentation for this attribute. + DOC end ``` Now instead of creating an instance like that: @@ -62,9 +69,39 @@ ```rb amount = Amount.build do |a| a.value = 2.3 a.currency = 'PLN' +end +``` + +If you use sorbet and run `bundle exec tapioca dsl` you'll get the following RBI file. + +```rb +# typed: true + +class Amount + include ShaleAttributeMethods + + module ShaleAttributeMethods + sig { returns(T.nilable(Float)) } + def value; end + + sig { params(value: T.nilable(Float)).returns(T.nilable(Float)) } + def value=(value); end + + # This is some custom documentation that can be used by sorbet. + # It will be used by the tapioca DSL compiler + # to generate the RBI documentation for this attribute. + sig { returns(T.nilable(String)) } + def currency; end + + # This is some custom documentation that can be used by sorbet. + # It will be used by the tapioca DSL compiler + # to generate the RBI documentation for this attribute. + sig { params(value: T.nilable(String)).returns(T.nilable(String)) } + def currency=(value); end + end end ``` ### Building nested objects