Sha256: 04d037337b54cd109a2868c5742a3df4019b24169fea5181cc5efe18ccf88f8a

Contents?: true

Size: 1.02 KB

Versions: 74

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

require 'avm/data/callbacks'
require 'eac_ruby_utils/core_ext'

module Avm
  module Data
    class Unit
      acts_as_abstract(
        do_clear: [],
        do_dump: [:dump_path],
        do_load: [:dump_path],
        dump_path_extension: []
      )
      enable_speaker
      include ::Avm::Data::Callbacks

      # @param dump_path [Pathname]
      # @return [void]
      def clear
        run_callbacks(:dump) { do_clear }
      end

      # @param dump_path [Pathname]
      # @return [void]
      def dump(dump_path)
        run_callbacks :dump do
          infom "Dumping unit \"#{name}\" to \"#{dump_path}\"..."
          do_dump(dump_path)
        end
      end

      # @param dump_path [Pathname]
      # @return [void]
      def load(dump_path)
        run_callbacks :load do
          clear
          infom "Loading unit \"#{name}\" from \"#{dump_path}\"..."
          do_load(dump_path)
        end
      end

      # @return [String]
      def name
        self.class.name
      end
    end
  end
end

Version data entries

74 entries across 74 versions & 2 rubygems

Version Path
avm-0.86.0 lib/avm/data/unit.rb
eac_tools-0.86.4 sub/avm/lib/avm/data/unit.rb
eac_tools-0.86.3 sub/avm/lib/avm/data/unit.rb
avm-0.85.0 lib/avm/data/unit.rb
eac_tools-0.86.2 sub/avm/lib/avm/data/unit.rb
avm-0.84.3 lib/avm/data/unit.rb
eac_tools-0.86.1 sub/avm/lib/avm/data/unit.rb
eac_tools-0.84.2 sub/avm/lib/avm/data/unit.rb
avm-0.84.2 lib/avm/data/unit.rb
eac_tools-0.84.1 sub/avm/lib/avm/data/unit.rb
avm-0.84.1 lib/avm/data/unit.rb
eac_tools-0.84.0 sub/avm/lib/avm/data/unit.rb
avm-0.84.0 lib/avm/data/unit.rb
eac_tools-0.83.0 sub/avm/lib/avm/data/unit.rb
avm-0.83.0 lib/avm/data/unit.rb
eac_tools-0.82.0 sub/avm/lib/avm/data/unit.rb
avm-0.82.0 lib/avm/data/unit.rb
eac_tools-0.81.0 sub/avm/lib/avm/data/unit.rb
eac_tools-0.80.0 sub/avm/lib/avm/data/unit.rb
avm-0.81.0 lib/avm/data/unit.rb