Class: Avm::EacGenericBase0::FileFormats::Base

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

Constant Summary collapse

VALID_BASENAMES =
%w[*.asm *.bat *.coffee *.java *.js *.rb *.s *.sql *.tex *.url *.yml
*.yaml].freeze
VALID_TYPES =
%w[plain x-shellscript].freeze

Instance Method Summary collapse

Instance Method Details

#file_apply(file) ⇒ Object



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

def file_apply(file)
  file.write(string_apply(file.read))
end

#internal_apply(files) ⇒ Object



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

def internal_apply(files)
  files.each { |file| file_apply(file) }
end

#string_apply(string) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/avm/eac_generic_base0/file_formats/base.rb', line 22

def string_apply(string)
  b = ''
  string.each_line do |line|
    b += "#{line.rstrip}\n"
  end
  "#{b.strip}\n".gsub(/\t/, '  ')
end