Sha256: 40e2864ba17d6af5bf7b8650305a9899ff12ff6f9b703c599abb27fe724eeda5
Contents?: true
Size: 640 Bytes
Versions: 12
Compression:
Stored size: 640 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
12 entries across 12 versions & 2 rubygems