Sha256: 7205152b95a366ebb29646bea81ae8558605ace3d51292a7dfeacc288aba3d2b

Contents?: true

Size: 312 Bytes

Versions: 4

Compression:

Stored size: 312 Bytes

Contents

# Provides Template module for registering erb templates
require 'opal-template'

class ERB
  def initialize(name, &body)
    @body = body
    @name = name
    Template[name] = self
  end

  def inspect
    "#<ERB: name=#{@name.inspect}>"
  end

  def render(ctx = self)
    ctx.instance_eval(&@body)
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
opal-erb-0.2.0 opal/erb.rb
opal-erb-0.1.0 opal/erb.rb
opal-0.3.44 opal/erb.rb
opal-0.3.43 opal/erb.rb