Method: Typefactory::Processor#cleanup

Defined in:
lib/typefactory/processor.rb

#cleanupObject (private)

Очищает текст от уже расставленных глифов



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/typefactory/processor.rb', line 35

def cleanup
  Typefactory::glyphs.each do |key, glyph|
    @buffer.gsub!(/#{glyph[:entity]}|#{glyph[:decimal]}|#{glyph[:symbol]}/) do
      glyph[:mark]
    end
  end

  expression = ''
  Typefactory::quotes.each_pair do |locale, quotes|
    quotes.each do |level|
      level.each do |side, glyph|
        expression += "#{glyph[:symbol]}|#{glyph[:entity]}|#{glyph[:decimal]}|"
      end
    end
  end
  @buffer.gsub!(/#{expression[0..-2]}/, Typefactory::glyphs[:quot][:mark])
end