Class: Avm::Files::Formatter::Formats::GenericPlain
- Inherits:
-
Base
- Object
- Base
- Avm::Files::Formatter::Formats::GenericPlain
show all
- Defined in:
- lib/avm/files/formatter/formats/generic_plain.rb
Constant Summary
collapse
- VALID_BASENAMES =
%w[*.bat *.css.coffee *.java *.js *.rb *.scss *.sql *.tex *.url *.yml
*.yaml].freeze
- VALID_TYPES =
%w[plain x-shellscript].freeze
Instance Method Summary
collapse
Methods inherited from Base
#apply, #match?, #name, #valid_basenames, #valid_types
Instance Method Details
#file_apply(file) ⇒ Object
19
20
21
|
# File 'lib/avm/files/formatter/formats/generic_plain.rb', line 19
def file_apply(file)
file.write(string_apply(file.read))
end
|
#internal_apply(files) ⇒ Object
15
16
17
|
# File 'lib/avm/files/formatter/formats/generic_plain.rb', line 15
def internal_apply(files)
files.each { |file| file_apply(file) }
end
|
#string_apply(string) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/avm/files/formatter/formats/generic_plain.rb', line 23
def string_apply(string)
b = ''
string.each_line do |line|
b += "#{line.rstrip}\n"
end
"#{b.strip}\n".gsub(/\t/, ' ')
end
|