Module: Cuca::Generator::Markaby
- Included in:
- ARFormWidget, BaseList, FormErrorsWidget, LinkWidget
- Defined in:
- lib/cuca/generator/markaby.rb
Overview
Markaby Generator
Markaby Generator provides the mab and mabtext functions to generate content.
Usage example within a controller:
require 'cuca/generator/markaby'
class IndexController < ApplicationController
include Cuca::Generator::Markaby
def run
mab { Link('/to/somewhere') { b { "Click" }}}
end
end
The above will make use of widget ‘LinkWidget’ (must be defined)
For more information of Markaby pls see the markaby website.
Performance Warning
Unfortunately Markaby is not famous to be fast. Using it on recuring widgets can significantly slow down your application.
Instance Method Summary collapse
-
#mab(&block) ⇒ Object
use this to add markaby code to @content.
-
#mabtext(&block) ⇒ Object
Use this to generate html code with a markaby block and have it as a string.
Instance Method Details
#mab(&block) ⇒ Object
use this to add markaby code to @content
80 81 82 |
# File 'lib/cuca/generator/markaby.rb', line 80 def mab(&block) @_content << ::Markaby::Builder.new(get_assigns, self, &block).to_s end |
#mabtext(&block) ⇒ Object
Use this to generate html code with a markaby block and have it as a string
85 86 87 |
# File 'lib/cuca/generator/markaby.rb', line 85 def mabtext(&block) ::Markaby::Builder.new(get_assigns, self, &block).to_s end |