Sha256: 479a4c92e661358ca94cd08555d71d5609a7258c4d63724454a7e071e5db709b
Contents?: true
Size: 653 Bytes
Versions: 1
Compression:
Stored size: 653 Bytes
Contents
# frozen_string_literal: true module User::Repository include ::BCDD::Contract::Interface module Methods module Input is_string = ::BCDD::Contract[String] is_filled = ->(val) { val.present? or '%p must be filled' } email_format = ->(val) { val.match?(/\A[^@\s]+@[^@\s]+\z/) or '%p must be an email' } Name = is_string & is_filled Email = is_string & is_filled & email_format end def create(name:, email:) output = super(name: +Input::Name[name], email: +Input::Email[email]) output => ::User::Data[id: Integer, name: Input::Name, email: Input::Email] output end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bcdd-contract-0.1.0 | examples/ports_and_adapters/lib/user/repository.rb |