Skip to content

Instantly share code, notes, and snippets.

@sled
Created April 13, 2016 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sled/9cd41495aab6487a3b992a43540185a4 to your computer and use it in GitHub Desktop.
Save sled/9cd41495aab6487a3b992a43540185a4 to your computer and use it in GitHub Desktop.
# Put this in app/types/types/address.rb then
# rails c
# Types::Address.new
# (change zip to Types::String)
# reload!
# Types::Address.new
module Types
class Address < Dry::Types::Struct
constructor_type(:schema)
attribute :zip, Types::Int
attribute :city, Types::String
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment