Class: Avm::Files::Formatter::Utf8Assert
- Inherits:
-
Object
- Object
- Avm::Files::Formatter::Utf8Assert
- Defined in:
- lib/avm/files/formatter/utf8_assert.rb
Constant Summary collapse
- UTF8_CHARSET =
'utf-8'
- UTF8_CHARSETS =
[UTF8_CHARSET, 'us-ascii'].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.assert_files(files) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/avm/files/formatter/utf8_assert.rb', line 13 def assert_files(files) asserters = files.map { |file| new(file) } begin asserters.each(&:assert) yield ensure asserters.each(&:revert) end end |
Instance Method Details
#assert ⇒ Object
27 28 29 30 31 |
# File 'lib/avm/files/formatter/utf8_assert.rb', line 27 def assert return if original_utf8? convert_self(original_charset, UTF8_CHARSET) end |
#revert ⇒ Object
33 34 35 36 37 |
# File 'lib/avm/files/formatter/utf8_assert.rb', line 33 def revert return if original_utf8? convert_self(UTF8_CHARSET, original_charset) end |