Sha256: 1bffd26489a1b88001d6fb412e3d4cae1078d7d192d30bee67806ac34b370293

Contents?: true

Size: 601 Bytes

Versions: 1

Compression:

Stored size: 601 Bytes

Contents

$: << 'lib'

TMPL = <<-'EOF'
div.menu! do
  [1, 2, 3, 4].map { |n| a("Section #{n}", :href => "/section/#{n}") }.join ' | '
end
EOF

require 'mab'

class MabExample
  include Mab::Mixin::XHTML5

  class_eval "def content() #{TMPL} end"

  def to_html
    mab { content }
  end
end

require 'erector'

class ErectorExample < Erector::Widget
  class_eval "def content() #{TMPL} end"
end

puts MabExample.new.to_html
puts ErectorExample.new.to_html

require 'benchmark/ips'

Benchmark.ips do |x|
  x.report('Mab')     { MabExample.new.to_html }
  x.report('Erector') { ErectorExample.new.to_html }
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mab-0.0.2 bench.rb