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.86.0 lib/avm/instances/process.rb
eac_tools-0.86.4 sub/avm/lib/avm/instances/process.rb
eac_tools-0.86.3 sub/avm/lib/avm/instances/process.rb
avm-0.85.0 lib/avm/instances/process.rb
eac_tools-0.86.2 sub/avm/lib/avm/instances/process.rb
avm-0.84.3 lib/avm/instances/process.rb
eac_tools-0.86.1 sub/avm/lib/avm/instances/process.rb
eac_tools-0.84.2 sub/avm/lib/avm/instances/process.rb
avm-0.84.2 lib/avm/instances/process.rb
eac_tools-0.84.1 sub/avm/lib/avm/instances/process.rb
avm-0.84.1 lib/avm/instances/process.rb
eac_tools-0.84.0 sub/avm/lib/avm/instances/process.rb
avm-0.84.0 lib/avm/instances/process.rb
eac_tools-0.83.0 sub/avm/lib/avm/instances/process.rb
avm-0.83.0 lib/avm/instances/process.rb
eac_tools-0.82.0 sub/avm/lib/avm/instances/process.rb
avm-0.82.0 lib/avm/instances/process.rb
eac_tools-0.81.0 sub/avm/lib/avm/instances/process.rb
eac_tools-0.80.0 sub/avm/lib/avm/instances/process.rb
avm-0.81.0 lib/avm/instances/process.rb