Sha256: b3f552c9a2ef690b4f7fd35abeb7e78707444b2fe10b1eaca850717911445737

Contents?: true

Size: 690 Bytes

Versions: 23

Compression:

Stored size: 690 Bytes

Contents

# encoding: UTF-8
$KCODE = 'u' unless "1.9".respond_to?(:encoding)

$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
require "htmlentities"

class HTMLEntitiesJob
  def initialize
    @coder = HTMLEntities.new
    @decoded = File.read(File.join(File.dirname(__FILE__), "sample"))
    @encoded = @coder.encode(@decoded, :basic, :named, :hexadecimal)
  end

  def encode(cycles)
    cycles.times do
      @coder.encode(@decoded, :basic, :named, :hexadecimal)
      @coder.encode(@decoded, :basic, :named, :decimal)
    end
  end

  def decode(cycles)
    cycles.times do
      @coder.decode(@encoded)
    end
  end

  def all(cycles)
    encode(cycles)
    decode(cycles)
  end
end

Version data entries

23 entries across 23 versions & 9 rubygems

Version Path
htmlentitties-4.2.1 perf/performance.rb
htmlentities-4.2.1 perf/performance.rb
htmlentities-4.2.0 perf/performance.rb