Sha256: 2ee485435fe785c04697499e78004a1ab840c95023a731f1cd81ceedc1c09175

Contents?: true

Size: 512 Bytes

Versions: 1

Compression:

Stored size: 512 Bytes

Contents

class Guinness::View

  def initialize(template)
    @template = template
  end

  # return a view body or nil if adequate template cannot be found
  def render
    template_body = Tilt.new(@template).render(self)
    if @layout
      layout = Dir[File.join(File.dirname(@template), @layout) + '*'].first
      raise "#{Guinness::EMOJI} Guinness : Unable to locate layout at: '#{@layout}'" unless layout
      @body = Tilt.new(layout).render(self) { template_body }
    end
    @body || template_body
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
guinness-0.1.0 lib/guinness/view.rb