Class: Avm::Data::Unit
- Inherits:
-
Object
- Object
- Avm::Data::Unit
- Includes:
- ActiveSupport::Callbacks
- Defined in:
- lib/avm/data/unit.rb
Direct Known Subclasses
Instance Method Summary collapse
- #dump(data_path) ⇒ Object
- #dump_to_directory(directory, identifier) ⇒ Object
- #extension ⇒ Object
- #load(data_path) ⇒ Object
- #load_from_directory(directory, identifier) ⇒ Object
- #name ⇒ Object
Instance Method Details
#dump(data_path) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/avm/data/unit.rb', line 62 def dump(data_path) run_callbacks :dump do infom "Dumping unit \"#{name}\" to \"#{data_path}\"..." dump_command.execute!(output_file: data_path) end end |
#dump_to_directory(directory, identifier) ⇒ Object
58 59 60 |
# File 'lib/avm/data/unit.rb', line 58 def dump_to_directory(directory, identifier) dump(unit_on_directory_path(directory, identifier)) end |
#extension ⇒ Object
44 45 46 47 48 |
# File 'lib/avm/data/unit.rb', line 44 def extension singleton_class.const_get('EXTENSION') rescue NameError '' end |
#load(data_path) ⇒ Object
69 70 71 72 73 74 |
# File 'lib/avm/data/unit.rb', line 69 def load(data_path) run_callbacks :load do infom "Loading unit \"#{name}\" from \"#{data_path}\"..." load_command.execute!(input_file: data_path) end end |
#load_from_directory(directory, identifier) ⇒ Object
54 55 56 |
# File 'lib/avm/data/unit.rb', line 54 def load_from_directory(directory, identifier) load(unit_on_directory_path(directory, identifier)) end |
#name ⇒ Object
50 51 52 |
# File 'lib/avm/data/unit.rb', line 50 def name self.class end |