Module: Ramaze::Helper::Markaby
- Defined in:
- lib/ramaze/helper/markaby.rb
Overview
Allows you to use some shortcuts for markaby in your Controller.
Instance Method Summary collapse
-
#markaby(ivs = {}, helpers = nil, &block) ⇒ Object
(also: #mab)
use this inside your controller to directly build Markaby Refer to the Markaby-documentation and testsuite for more examples.
Instance Method Details
#markaby(ivs = {}, helpers = nil, &block) ⇒ Object Also known as: mab
use this inside your controller to directly build Markaby Refer to the Markaby-documentation and testsuite for more examples. Usage:
mab { h1 "Apples & Oranges"} #=> "<h1>Apples & Oranges</h1>"
mab { h1 'Apples', :class => 'fruits&floots' } #=> "<h1 class=\"fruits&floots\">Apples</h1>"
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ramaze/helper/markaby.rb', line 15 def markaby(ivs = {}, helpers = nil, &block) builder = ::Markaby::Builder builder.extend(Ramaze::Helper::Methods) builder.send(:helper, :link) iv_hash = {} instance_variables.each do |iv| key, value = iv.gsub('@', '').to_sym, instance_variable_get(iv) iv_hash[key] = value end builder.new(iv_hash.merge(ivs), helpers, &block).to_s end |