Sha256: 621ca3ff6f8e7f07bb1064186ea2fd205f98404ba95719d3bdfe76eea9641111
Contents?: true
Size: 894 Bytes
Versions: 6
Compression:
Stored size: 894 Bytes
Contents
# frozen_string_literal: true module Decidim module Elections module TrusteeZone # This command allows the user to update their trustee information class UpdateTrustee < Rectify::Command # Public: Initializes the command. # # form - A form with the new trustee information def initialize(form) @form = form end # Update the trustee if valid. # # Broadcasts :ok if successful, :invalid otherwise. def call return broadcast(:invalid) if form.invalid? update_trustee! broadcast(:ok, trustee) end private attr_reader :form delegate :trustee, to: :form def update_trustee! trustee.update!( name: form.name, public_key: form.public_key ) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems