Sha256: 23b65663d1f2406e8c3f2cd86f26cc3e66d4f8382c137ac374062762287e239f

Contents?: true

Size: 407 Bytes

Versions: 7

Compression:

Stored size: 407 Bytes

Contents

class SmallCage::Renderer

  def initialize(loader)
    @loader = loader
  end

  def render(name, obj)
    path = @loader.template_path(name)
    return nil if path.nil?
    return render_string(path.read, obj)
  end
    
  def render_string(str, obj)
    erb_class = ERB.new(str, nil, '-').def_class(@loader.erb_base, "erb")
    result = erb_class.new(@loader, self, obj).erb
    return result
  end

end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
bluemark-smallcage-0.1.3 lib/smallcage/renderer.rb
smallcage-0.1.2 lib/smallcage/renderer.rb
smallcage-0.0.9 lib/smallcage/renderer.rb
smallcage-0.1.0 lib/smallcage/renderer.rb
smallcage-0.1.1 lib/smallcage/renderer.rb
smallcage-0.0.8 lib/smallcage/renderer.rb
smallcage-0.1.3 lib/smallcage/renderer.rb