Class: Tabit::Builder

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

Instance Attribute Summary

Attributes inherited from Item

#active, #name, #options, #type, #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:



27
28
29
30
31
32
# File 'lib/tabit/builder.rb', line 27

def initialize(template, options)
  self.template = template
  self.options = options

  yield self if block_given?
end

Instance Method Details

#childrenObject



46
47
48
# File 'lib/tabit/builder.rb', line 46

def children
  @children ||= []
end

#to_sObject



34
35
36
37
38
39
40
41
42
43
44
# File 'lib/tabit/builder.rb', line 34

def to_s
  current_options = options
  current_options.delete :outer
  current_options.delete :inner

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