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
eac_tools-0.79.0 sub/avm/lib/avm/instances/process.rb
avm-0.80.0 lib/avm/instances/process.rb
eac_tools-0.78.0 sub/avm/lib/avm/instances/process.rb
eac_tools-0.77.1 sub/avm/lib/avm/instances/process.rb
eac_tools-0.77.0 sub/avm/lib/avm/instances/process.rb
eac_tools-0.76.1 sub/avm/lib/avm/instances/process.rb
eac_tools-0.76.0 sub/avm/lib/avm/instances/process.rb
eac_tools-0.75.2 sub/avm/lib/avm/instances/process.rb
eac_tools-0.75.1 sub/avm/lib/avm/instances/process.rb
eac_tools-0.75.0 sub/avm/lib/avm/instances/process.rb
eac_tools-0.74.1 sub/avm/lib/avm/instances/process.rb
eac_tools-0.74.0 sub/avm/lib/avm/instances/process.rb
avm-0.79.0 lib/avm/instances/process.rb
eac_tools-0.73.0 sub/avm/lib/avm/instances/process.rb
eac_tools-0.72.0 sub/avm/lib/avm/instances/process.rb
avm-0.78.0 lib/avm/instances/process.rb
eac_tools-0.70.1 sub/avm/lib/avm/instances/process.rb