Class: Tabit::Builder

Inherits:
Item
  • Object
show all
Defined in:
lib/tabit/builder.rb

Instance Attribute Summary

Attributes inherited from Item

#active, #children, #name, #options, #url

Instance Method Summary collapse

Methods inherited from Item

#active?, #add, #divider, #heading

Constructor Details

#initialize(template, options) {|_self| ... } ⇒ Builder

Returns a new instance of Builder.

Yields:

  • (_self)

Yield Parameters:



4
5
6
7
8
9
10
11
# File 'lib/tabit/builder.rb', line 4

def initialize(template, options, &block)
  @@template = template

  @children = []
  @options = options

  yield self if block_given?
end

Instance Method Details

#to_sObject



13
14
15
16
17
18
19
# File 'lib/tabit/builder.rb', line 13

def to_s
  template.(
    :ul,
    children.collect(&:to_s).join.html_safe,
    options
  )
end