Sha256: 018dca33fa2a1cf1dec5a79cefc0ffbd47616530f04bf8ebdfa7c75a1dd7ed97
Contents?: true
Size: 455 Bytes
Versions: 9
Compression:
Stored size: 455 Bytes
Contents
require 'dry-monads' require 'main/entities/user' require 'main/import' module Main module Transactions class RegisterUser include Dry::Monads::Either::Mixin include Main::Import['persistence.db'] def call(params) if params['name'] Right(db[:users] << Main::Entities::User.new(*params.values_at('id', 'name'))) else Left(validation: 'name is missing') end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems