Sha256: 36b53a797b38136c1ebabdb4dc5f30d4411e793eecf471ee071f9a702368feb8

Contents?: true

Size: 921 Bytes

Versions: 1

Compression:

Stored size: 921 Bytes

Contents

begin
  require 'markaby'
rescue LoadError => e
  raise MissingLibrary, "Markaby could not be loaded (is it installed?): #{e.message}"
end

Markaby::Builder.set(:indent, 2)

module Capcode
  class Mab < Markaby::Builder
    include Views
  end
  
  module Helpers
    def render_markaby( f, opts ) #:nodoc:
      f = f.to_s
      layout = opts.delete(:layout)||:layout

      assigns = {}
      self.instance_variables.delete_if {|x| ["@response", "@env", "@request"].include?(x) }.each do |ivar|
        assigns[ivar.gsub( /^@/, "" )] = self.instance_variable_get(ivar)
      end

      __mab = Mab.new(assigns.merge( opts ), self) { 
        if self.respond_to?(layout)
          self.send(layout.to_s) { |*args| 
            # @@__ARGS__ = args
            Capcode::Helpers.args = args
            self.send(f) 
          }
        else
          self.send(f) 
        end
      }
      __mab.to_s  
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
Capcode-0.8.9 lib/capcode/render/markaby.rb