Sha256: 0bc89ea91f54f0bcdcb53d8ff24bf8e4e912287d91036e1d5514902816f14794
Contents?: true
Size: 641 Bytes
Versions: 23
Compression:
Stored size: 641 Bytes
Contents
# frozen_string_literal: true module Praxis module Finalizable def self.extended(klass) klass.module_eval do @finalizable = Set.new end end def inherited(base) @finalizable << base base.instance_variable_set(:@finalizable, @finalizable) base.instance_variable_set(:@finalized, false) end def finalizable @finalizable end def finalized? @finalized end def _finalize! @finalized = true end def finalize! finalizable.reject(&:finalized?).each(&:_finalize!) finalize! unless finalizable.all?(&:finalized?) end end end
Version data entries
23 entries across 23 versions & 1 rubygems