Class: Avm::Instances::Data::Unit

Inherits:
Data::UnitWithCommands show all
Defined in:
lib/avm/instances/data/unit.rb

Direct Known Subclasses

FilesUnit

Instance Method Summary collapse

Methods inherited from Data::UnitWithCommands

#dump_path_extension, #dump_to_directory, #installation_files_data, #load_from_directory

Methods inherited from Data::Unit

#clear, #dump, #name

Instance Method Details

#check_load_permission!void

This method returns an undefined value.

Raises:

  • Avm::Instances::Data::Unit



15
16
17
18
19
# File 'lib/avm/instances/data/unit.rb', line 15

def check_load_permission!
  return if instance.data_allow_loading

  raise ::Avm::Instances::Data::LoadingDeniedError, "Instance: #{instance}"
end

#data_default_dump_pathPathname

Returns:

  • (Pathname)


22
23
24
25
26
# File 'lib/avm/instances/data/unit.rb', line 22

def data_default_dump_path
  instance.data_default_dump_path.to_pathname.basename_sub('.*') do |b|
    "#{b}_#{identifier}#{dump_path_extension}"
  end
end

#identifierString

Returns:

  • (String)


29
30
31
# File 'lib/avm/instances/data/unit.rb', line 29

def identifier
  instance.data_package.units.key(self) || raise("No identifier found for #{self}")
end

#loadObject



33
34
35
36
# File 'lib/avm/instances/data/unit.rb', line 33

def load(...)
  check_load_permission!
  instance.on_disabled_processes { super }
end