Sha256: 593f3c5bafc9d186c7f57ac4578098c202c738af2bb082e80d292593aee16450

Contents?: true

Size: 1.02 KB

Versions: 41

Compression:

Stored size: 1.02 KB

Contents

#          Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

module Ramaze

  # Allows you to use some shortcuts for markaby in your Controller.

  module Helper::Markaby
    # 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 &amp; Oranges</h1>"
    #   mab { h1 'Apples', :class => 'fruits&floots' }  #=> "<h1 class=\"fruits&amp;floots\">Apples</h1>"

    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

    alias mab markaby
  end
end

Version data entries

41 entries across 41 versions & 5 rubygems

Version Path
Pistos-ramaze-2008.09 lib/ramaze/helper/markaby.rb
Pistos-ramaze-2008.12 lib/ramaze/helper/markaby.rb
Pistos-ramaze-2009.04.08 lib/ramaze/helper/markaby.rb
Pistos-ramaze-2009.06.12 lib/ramaze/helper/markaby.rb
clivecrous-ramaze-0.3.9.5 lib/ramaze/helper/markaby.rb
manveru-ramaze-2008.07 lib/ramaze/helper/markaby.rb
manveru-ramaze-2008.08 lib/ramaze/helper/markaby.rb
manveru-ramaze-2008.09 lib/ramaze/helper/markaby.rb
manveru-ramaze-2008.10 lib/ramaze/helper/markaby.rb
manveru-ramaze-2008.12 lib/ramaze/helper/markaby.rb
manveru-ramaze-2009.04.01 lib/ramaze/helper/markaby.rb
manveru-ramaze-2009.04.08 lib/ramaze/helper/markaby.rb
manveru-ramaze-2009.04.18 lib/ramaze/helper/markaby.rb
manveru-ramaze-2009.04.22 lib/ramaze/helper/markaby.rb
manveru-ramaze-2009.04 lib/ramaze/helper/markaby.rb
manveru-ramaze-2009.05.08 lib/ramaze/helper/markaby.rb
manveru-ramaze-2009.05 lib/ramaze/helper/markaby.rb
manveru-ramaze-2009.06.04 lib/ramaze/helper/markaby.rb
manveru-ramaze-2009.06.12 lib/ramaze/helper/markaby.rb
manveru-ramaze-2009.06 lib/ramaze/helper/markaby.rb