Closed dsisnero closed 2 years ago
Not sure how to make a length, weight, speed quantity with dry-types
Dry::Types.load_extensions(:length) module Types include Dry.Types() end
class Equipment < Dry::Struct attribute :height, Types::Params::Length.inches() attribute :width, Types::Params::Length.inches()
end
radio = Equipment.new( height: "3", width: "4") puts radio.height => "3 inches"
Pls forward questions or feature requests to our forum https://discourse.dry-rb.org/ (see CONTRIBUTING.md)
A type system should handle compound types like Quantity
Not sure how to make a length, weight, speed quantity with dry-types
Expected behavior
Dry::Types.load_extensions(:length) module Types include Dry.Types() end
class Equipment < Dry::Struct attribute :height, Types::Params::Length.inches() attribute :width, Types::Params::Length.inches()
end
radio = Equipment.new( height: "3", width: "4") puts radio.height => "3 inches"