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.94.0 lib/avm/data/unit.rb
eac_tools-0.94.0 sub/avm/lib/avm/data/unit.rb
avm-0.93.0 lib/avm/data/unit.rb
eac_tools-0.92.0 sub/avm/lib/avm/data/unit.rb
avm-0.92.0 lib/avm/data/unit.rb
eac_tools-0.91.0 sub/avm/lib/avm/data/unit.rb
avm-0.90.1 lib/avm/data/unit.rb
eac_tools-0.87.1 sub/avm/lib/avm/data/unit.rb
avm-0.90.0 lib/avm/data/unit.rb
eac_tools-0.87.0 sub/avm/lib/avm/data/unit.rb
avm-0.89.0 lib/avm/data/unit.rb
eac_tools-0.86.12 sub/avm/lib/avm/data/unit.rb
avm-0.88.0 lib/avm/data/unit.rb
eac_tools-0.86.11 sub/avm/lib/avm/data/unit.rb
avm-0.87.0 lib/avm/data/unit.rb
eac_tools-0.86.8 sub/avm/lib/avm/data/unit.rb
avm-0.86.2 lib/avm/data/unit.rb
eac_tools-0.86.7 sub/avm/lib/avm/data/unit.rb
avm-0.86.1 lib/avm/data/unit.rb
eac_tools-0.86.5 sub/avm/lib/avm/data/unit.rb