Sha256: 9eb4dfb670c5aa074db0ff4215e123a9d4a58c85ab075d3a0cbcd3de3c443417

Contents?: true

Size: 646 Bytes

Versions: 2

Compression:

Stored size: 646 Bytes

Contents

require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'rack-plastic')
require File.join(File.dirname(__FILE__), '..', '..', 'lib', 'plastic_helper')

# This middleware converts the text of every paragraph to leetspeak.
#
module Rack
  class L337 < Plastic
 
    def change_nokogiri_doc(doc)
      doc.css("p").each do |p|
        p.traverse do |node|
          if node.text?
            l337_text = node.content.upcase.tr('ABCDEFGHIJKLMNOPQRSTUVWXYZ',
                                               '48CD3F6H1JKLMN0P9R57UVWxY2')
            update_text(node, l337_text)
          end
        end
      end
      doc
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rack-plastic-0.0.2 test/middlewares/l337.rb
rack-plastic-0.0.1 test/middlewares/l337.rb