Sha256: 43f2439b059cb60b91e47f6ed981d6a074139c091099436f070e7c6a9b462f4b
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
begin require 'markaby' rescue LoadError => e raise MissingLibrary, "Markaby could not be loaded (is it installed?): #{e.message}" end 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 # Update options (Capcode::Configuration.options[:markaby] || {}).merge(opts).each do |k, v| Markaby::Builder.set(k, v) end 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-render-markaby-0.2.0 | lib/capcode/render/markaby.rb |