Class: TwitterBootstrapBuilder::Builders::DropDownBuilder

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

Direct Known Subclasses

DropDownButtonBuilder, DropDownLinkBuilder

Instance Attribute Summary

Attributes inherited from Base

#block, #options, #template

Instance Method Summary collapse

Methods inherited from Base

#html_safe, #initialize

Constructor Details

This class inherits a constructor from TwitterBootstrapBuilder::Builders::Base

Instance Method Details



14
15
16
# File 'lib/twitter_bootstrap_builder/builders/drop_down_builder.rb', line 14

def link_to(*args, &block)
  Tag.block(:li, template.link_to(*args, &block)).to_s.html_safe
end

#to_sObject



5
6
7
8
9
10
11
12
# File 'lib/twitter_bootstrap_builder/builders/drop_down_builder.rb', line 5

def to_s
  dropdown = self.dropdown_class.new(options[:text])
  dropdown.append template.capture(self, &block) if block
  dropdown.send(options[:type]) if options[:type] && dropdown.respond_to?(options[:type])
  dropdown.send(options[:size]) if options[:size] && dropdown.respond_to?(options[:size])
  dropdown.as_nav_item if dropdown.respond_to? :as_nav_item
  dropdown.to_s
end