Class: TwitterBootstrapBuilder::Builders::TabBuilder

Inherits:
Base
  • Object
show all
Defined in:
lib/twitter_bootstrap_builder/builders/tab_builder.rb

Instance Attribute Summary

Attributes inherited from Base

#block, #options, #template

Instance Method Summary collapse

Methods inherited from Base

#html_safe

Constructor Details

#initialize(*args, &block) ⇒ TabBuilder

Returns a new instance of TabBuilder.



5
6
7
8
# File 'lib/twitter_bootstrap_builder/builders/tab_builder.rb', line 5

def initialize(*args, &block)
  super
  @tab = Tab.new
end

Instance Method Details

#content_for(text, id = nil, &block) ⇒ Object



15
16
17
18
19
# File 'lib/twitter_bootstrap_builder/builders/tab_builder.rb', line 15

def content_for(text, id=nil, &block)
  id = text.parameterize('_') unless id
  @tab.nav.append NavTab.new(text, "##{id}")
  @tab.content.append id, template.capture(self, &block) if block_given?
end

#to_sObject



10
11
12
13
# File 'lib/twitter_bootstrap_builder/builders/tab_builder.rb', line 10

def to_s
  template.capture(self, &block) if block
  @tab.to_s
end