Sha256: 25f37a5c580f36a94cb3418c799f491d129d27e1595e092a3ab8bfc6a0abff59

Contents?: true

Size: 828 Bytes

Versions: 1

Compression:

Stored size: 828 Bytes

Contents

- name: erb_compile
  prelude: |
    require 'erb'

    title = "hello world!"
    content = "hello world!\n" * 10

    data = <<EOS
    <html>
      <head> <%= title %> </head>
      <body>
        <h1> <%= title %> </h1>
        <p>
          <%= content %>
        </p>
      </body>
    </html>
    EOS

  benchmark: |
    ERB.new(data).src

- name: erb_render
  prelude: |
    require 'erb'

    title = "hello world!"
    content = "hello world!\n" * 10

    data = <<EOS
    <html>
      <head> <%= title %> </head>
      <body>
        <h1> <%= title %> </h1>
        <p>
          <%= content %>
        </p>
      </body>
    </html>
    EOS

    src = "def self.render(title, content); #{ERB.new(data).src}; end"
    mod = Module.new
    mod.instance_eval(src, "(ERB)")

  benchmark: |
    mod.render(title, content)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
benchmark_driver-0.1.0 examples/erb_compile_render.yml