Sha256: c6a178fbbfe93931bf779a137a913b8d95791f1921f771e581dd4c95169b1e27
Contents?: true
Size: 737 Bytes
Versions: 1
Compression:
Stored size: 737 Bytes
Contents
require "virtus" require "undo/serializer/null" require "undo/storage/memory" require "securerandom" module Undo class Config include Virtus.model attribute :serializer, Object, default: Undo::Serializer::Null.new attribute :storage, Object, default: Undo::Storage::Memory.new attribute :uuid_generator, Proc, default: :default_uuid_generator def with(attribute_updates = {}) self.class.new attributes.merge attribute_updates end def filter(options) attribute_names = attribute_set.map(&:name) options.reject { |key, _| attribute_names.include? key.to_sym } end private def default_uuid_generator -> object { SecureRandom.uuid } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
undo-1.0.0 | lib/undo/config.rb |