Sha256: 6f45d831219d8705f735a22f656abc909653f89211773657ea069197338b380e

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

require File.join(File.dirname(__FILE__), 'base')
module Mack
  module Rendering # :nodoc:
    module Type # :nodoc:
      # This class allows for a template to be rendered inline in a controller, and not served from disk.
      # 
      # Examples:
      #   <%= render(:inline, "<%= 2 + 2 %> should equal 4") %> # => "4 should equal 4"
      #   <%= render(:inline, "xml.hello("Mark")", :engine => :builder) %> # => "<hello>Mark</hello>"
      class Inline < Mack::Rendering::Type::Base
        
        def render
          @engine = find_engine((self._options[:engine] || :erubis)).new(self.view_template)
          return @engine.render(self._render_value, self._binder)
        end
        
        # Passes concatenation messages through to the Mack::Rendering::Engine object.
        # This should append the text, using the passed in binding, to the final output
        # of the render.
        def concat(txt, b)
          @engine.concat(txt, b)
        end
        
      end # Inline
    end # Type
  end # Rendering
end # Mack

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mack-0.8.0.100 lib/mack/rendering/type/inline.rb
mack-0.8.0.101 lib/mack/rendering/type/inline.rb
mack-0.8.0.2 lib/mack/rendering/type/inline.rb
mack-0.8.1 lib/mack/rendering/type/inline.rb
mack-0.8.2 lib/mack/rendering/type/inline.rb
mack-0.8.3 lib/mack/rendering/type/inline.rb
mack-0.8.3.1 lib/mack/rendering/type/inline.rb