Class: Card::Bootstrap::Component
- Extended by:
- ComponentKlass
- Defined in:
- mod/bootstrap/lib/card/bootstrap/component.rb,
mod/bootstrap/lib/card/bootstrap/component/form.rb,
mod/bootstrap/lib/card/bootstrap/component/panel.rb,
mod/bootstrap/lib/card/bootstrap/component/layout.rb,
mod/bootstrap/lib/card/bootstrap/component/carousel.rb,
mod/bootstrap/lib/card/bootstrap/component/horizontal_form.rb
Overview
render components of bootstrap library
Direct Known Subclasses
Defined Under Namespace
Classes: Carousel, Form, HorizontalForm, Layout, Panel
Instance Method Summary collapse
-
#append(&block) ⇒ Object
-
#card ⇒ Object
-
#initialize(context, *args, &block) ⇒ Component
constructor
A new instance of Component.
-
#insert(&block) ⇒ Object
-
#prepend(&block) ⇒ Object
-
#render ⇒ Object
-
#wrap(tag = nil, &block) ⇒ Object
Methods included from ComponentKlass
def_div_method, def_tag_method
Methods included from Delegate
#method_missing, #respond_to_missing?
Methods included from BasicTags
Constructor Details
#initialize(context, *args, &block) ⇒ Component
Returns a new instance of Component.
7 8 9 10 11 12 13 14 15 16 |
# File 'mod/bootstrap/lib/card/bootstrap/component.rb', line 7 def initialize context, *args, &block @context = context @content = ["".html_safe] @args = args @child_args = [] @append = [] @wrap = [] @build_block = block @html = Builder::XmlMarkup.new end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Card::Bootstrap::Delegate
Instance Method Details
#append(&block) ⇒ Object
32 33 34 |
# File 'mod/bootstrap/lib/card/bootstrap/component.rb', line 32 def append &block @append[-1] << block end |
#card ⇒ Object
40 41 42 |
# File 'mod/bootstrap/lib/card/bootstrap/component.rb', line 40 def card @context.context.card end |
#insert(&block) ⇒ Object
28 29 30 |
# File 'mod/bootstrap/lib/card/bootstrap/component.rb', line 28 def insert &block instance_exec(&block) end |
#prepend(&block) ⇒ Object
22 23 24 25 26 |
# File 'mod/bootstrap/lib/card/bootstrap/component.rb', line 22 def prepend &block tmp = @content.pop instance_exec(&block) @content << tmp end |
#render ⇒ Object
18 19 20 |
# File 'mod/bootstrap/lib/card/bootstrap/component.rb', line 18 def render @rendered = render_content end |
#wrap(tag = nil, &block) ⇒ Object
36 37 38 |
# File 'mod/bootstrap/lib/card/bootstrap/component.rb', line 36 def wrap tag=nil, &block @wrap[-1] << (block_given? ? block : tag) end |