Sha256: 41a97c027258cc65b8dea683f0c95d9726fd67b1f148fc74f35586d82d80ada5

Contents?: true

Size: 674 Bytes

Versions: 57

Compression:

Stored size: 674 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'

module Avm
  module Instances
    class Process
      class << self
        # @return [Symbol]
        def default_id
          name.demodulize.underscore.to_sym
        end
      end

      acts_as_abstract :available?, :disable, :enable, :enabled?
      common_constructor :instance, :id, default: [nil] do
        self.id ||= (id || self.class.default_id).to_sym
      end

      def on_disabled(&block)
        previous_enabled = enabled?
        begin
          disable if previous_enabled
          block.call
        ensure
          enable if previous_enabled
        end
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 2 rubygems

Version Path
avm-0.94.0 lib/avm/instances/process.rb
eac_tools-0.94.0 sub/avm/lib/avm/instances/process.rb
avm-0.93.0 lib/avm/instances/process.rb
eac_tools-0.92.0 sub/avm/lib/avm/instances/process.rb
avm-0.92.0 lib/avm/instances/process.rb
eac_tools-0.91.0 sub/avm/lib/avm/instances/process.rb
avm-0.90.1 lib/avm/instances/process.rb
eac_tools-0.87.1 sub/avm/lib/avm/instances/process.rb
avm-0.90.0 lib/avm/instances/process.rb
eac_tools-0.87.0 sub/avm/lib/avm/instances/process.rb
avm-0.89.0 lib/avm/instances/process.rb
eac_tools-0.86.12 sub/avm/lib/avm/instances/process.rb
avm-0.88.0 lib/avm/instances/process.rb
eac_tools-0.86.11 sub/avm/lib/avm/instances/process.rb
avm-0.87.0 lib/avm/instances/process.rb
eac_tools-0.86.8 sub/avm/lib/avm/instances/process.rb
avm-0.86.2 lib/avm/instances/process.rb
eac_tools-0.86.7 sub/avm/lib/avm/instances/process.rb
avm-0.86.1 lib/avm/instances/process.rb
eac_tools-0.86.5 sub/avm/lib/avm/instances/process.rb