Class: Interview::Tab

Inherits:
Control show all
Includes:
HasControls
Defined in:
lib/interview/tab.rb

Instance Attribute Summary collapse

Attributes included from HasControls

#controls

Attributes inherited from Control

#parent

Instance Method Summary collapse

Methods included from HasControls

#add_control, #add_controls, included, #initialize, #siblings

Methods inherited from Control

#ancestors, build, definition, #find_attribute, #find_attribute!, inherited, #initialize, #set_attributes, #set_defaults

Instance Attribute Details

#activeObject

Returns the value of attribute active.



6
7
8
# File 'lib/interview/tab.rb', line 6

def active
  @active
end

#captionObject

Returns the value of attribute caption.



6
7
8
# File 'lib/interview/tab.rb', line 6

def caption
  @caption
end

Instance Method Details

#renderObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/interview/tab.rb', line 8

def render
  html = Builder::XmlMarkup.new
  html_class = 'tab-pane'
  html_class += ' active' if @active
  html.div class: html_class, id: @caption do
    @controls.each do |control|
      html << control.render
    end
  end
  return html.target!
end