Class: RailsBootstrapHelpers::Renderers::TabbableRenderer

Inherits:
Renderer
  • Object
show all
Defined in:
lib/rails-bootstrap-helpers/renderers/tabbable_renderer.rb

Defined Under Namespace

Classes: Pane, Tab, TabContext

Instance Attribute Summary

Attributes inherited from Renderer

#template

Instance Method Summary collapse

Methods inherited from Renderer

#method_missing

Constructor Details

#initialize(template, *args, &block) ⇒ TabbableRenderer

Returns a new instance of TabbableRenderer.



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/rails-bootstrap-helpers/renderers/tabbable_renderer.rb', line 3

def initialize (template, *args, &block)
  super template
  @args = args || []
  @block = block

  @options = {}
  @tabs = []
  @panes = []

  @last_id = 0
  @ids = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RailsBootstrapHelpers::Renderers::Renderer

Instance Method Details

#add_pane(block, options) ⇒ Object



26
27
28
# File 'lib/rails-bootstrap-helpers/renderers/tabbable_renderer.rb', line 26

def add_pane (block, options)
  @panes << Pane.new(block, options)
end

#add_tab(text, options) ⇒ Object



22
23
24
# File 'lib/rails-bootstrap-helpers/renderers/tabbable_renderer.rb', line 22

def add_tab (text, options)
  @tabs << Tab.new(text, options)
end

#renderObject



16
17
18
19
20
# File 'lib/rails-bootstrap-helpers/renderers/tabbable_renderer.rb', line 16

def render
  befor_block
    block.call TabContext.new(self)
  after_block
end