Class: Avm::FileFormats::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/avm/file_formats/base.rb

Instance Method Summary collapse

Instance Method Details

#apply(files) ⇒ Object



12
13
14
15
16
# File 'lib/avm/file_formats/base.rb', line 12

def apply(files)
  old_content = Hash[files.map { |f| [f, File.read(f)] }]
  ::Avm::FileFormats::Utf8Assert.assert_files(files) { internal_apply(files) }
  files.map { |f| build_file_result(f, old_content[f]) }
end

#match?(file) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/avm/file_formats/base.rb', line 22

def match?(file)
  match_by_filename?(file) || match_by_type?(file)
end

#nameObject



18
19
20
# File 'lib/avm/file_formats/base.rb', line 18

def name
  self.class.name.demodulize
end

#valid_basenamesObject



26
27
28
# File 'lib/avm/file_formats/base.rb', line 26

def valid_basenames
  constant_or_array('VALID_BASENAMES')
end

#valid_typesObject



30
31
32
# File 'lib/avm/file_formats/base.rb', line 30

def valid_types
  constant_or_array('VALID_TYPES')
end