class RbbtRESTHelpers::Tabs

Attributes

classes[RW]
codes[RW]
content[RW]
headers[RW]
tab_classes[RW]

Public Class Methods

new(page) click to toggle source
# File lib/rbbt/rest/common/tabs.rb, line 6
def initialize(page)
  @page = page
end

Public Instance Methods

active(header=nil) click to toggle source
# File lib/rbbt/rest/common/tabs.rb, line 27
def active(header=nil)
  @active ||= header.nil? ? false : header 
end
add(header = nil, code = nil, &block) click to toggle source
# File lib/rbbt/rest/common/tabs.rb, line 10
def add(header = nil, code = nil, &block)
  
  @headers ||= []
  @codes ||= {}
  @content ||= {}

  if block_given? 
    html = $haml_6 ? capture(&block) : @page.capture_haml(&block)
  else
    html = nil
  end

  @headers << header
  @codes[header] = code.to_s if code
  @content[header] = html
end