Sha256: fcbffa689e86e0ef948c8c2e10170140bda9ce2cc4ac4f1320502726c8b3b9f1
Contents?: true
Size: 673 Bytes
Versions: 9
Compression:
Stored size: 673 Bytes
Contents
# frozen_string_literal: true module Lite module Command module Extensions module Propagation private %i[archive destroy save].each do |action| define_method("#{action}_and_return!") do |klass| merge_errors!(klass) unless klass.send(action) klass end end def create_and_return!(klass, params) klass = klass.create(params) merge_errors!(klass) unless klass.errors.empty? klass end def update_and_return!(klass, params) merge_errors!(klass) unless klass.update(params) klass end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems