Class: TwitterBootstrapBuilder::Builders::NavListBuilder
- Inherits:
-
Base
- Object
- Base
- TwitterBootstrapBuilder::Builders::NavListBuilder
show all
- Defined in:
- lib/twitter_bootstrap_builder/builders/nav_list_builder.rb
Instance Attribute Summary
Attributes inherited from Base
#block, #options, #template
Instance Method Summary
collapse
Methods inherited from Base
#html_safe, #initialize
Instance Method Details
#active_link_to(*args, &block) ⇒ Object
24
25
26
|
# File 'lib/twitter_bootstrap_builder/builders/nav_list_builder.rb', line 24
def active_link_to(*args, &block)
Tag.block(:li, template.link_to(*args, &block), class: 'active').html_safe
end
|
#custom(&block) ⇒ Object
32
33
34
|
# File 'lib/twitter_bootstrap_builder/builders/nav_list_builder.rb', line 32
def custom(&block)
Tag.block(:li, template.capture(self, &block)).html_safe
end
|
#divider ⇒ Object
28
29
30
|
# File 'lib/twitter_bootstrap_builder/builders/nav_list_builder.rb', line 28
def divider
Tag.block(:li, Divider.horizontal).html_safe
end
|
11
12
13
|
# File 'lib/twitter_bootstrap_builder/builders/nav_list_builder.rb', line 11
def (text)
NavHeader.new(text).html_safe
end
|
#link_to(*args, &block) ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/twitter_bootstrap_builder/builders/nav_list_builder.rb', line 15
def link_to(*args, &block)
options = args.select { |a| a.is_a?(Hash) }.first || {}
if options[:active_if].is_a?(Proc) ? options[:active_if].call : options[:active_if]
active_link_to(*args, &block)
else
Tag.block(:li, template.link_to(*args, &block)).html_safe
end
end
|
#to_s ⇒ Object
5
6
7
8
9
|
# File 'lib/twitter_bootstrap_builder/builders/nav_list_builder.rb', line 5
def to_s
nav_list = NavList.new
nav_list.append template.capture(self, &block) if block
nav_list.to_s
end
|