Class: RbbtRESTHelpers::Tabs

Inherits:
Object
  • Object
show all
Includes:
RbbtRESTHelpers
Defined in:
lib/rbbt/rest/common/tabs.rb

Constant Summary

Constants included from RbbtRESTHelpers

MEMORY_CACHE, PAGE_SIZE

Instance Attribute Summary collapse

Attributes included from RbbtRESTHelpers

#javascript_resources, #plugin_resources, #sass_resources, #template_resources

Instance Method Summary collapse

Methods included from RbbtRESTHelpers

#add_GET_param, add_sass_load_path, #add_search_paths, #cache, #capture, #check_step, #consume_parameter, css_resources, #css_resources, #development?, #error_for, #escape_url, #file_or_text_area, file_resources, #file_resources, #filter, #find_all, #find_all_server_files, #fix_html, #fix_input, #form_input, #fragment, #glob_all, #glob_all_server_files, #halt_html, #hash2dl, #header, #html_tag, #input_label, javascript_resources, #json_resource, #link_css, #link_js, #load_tsv, load_tsv, #locate_css, #locate_file, #locate_javascript, #locate_sass, #locate_server_file, #locate_template, #log, #modal_fragment, #old_cache, #paginate, #param2boolean, #parse_page, #partial_render, #permalink, #prepare_input, #process_common_parameters, #production?, #progress, #record_css, #record_js, #recorded_css_files, #recorded_js_files, #remove_GET_param, #render, #render_partial, #render_sass, #reset_js_css, #resource, #reveal, sass_resources, save_tsv, #save_tsv, #serve_css, #serve_js, #sync_json_resources, #table, #table_value, #tabs, #tar_file, #template_render, template_resources, #traverse, #tsv2html, #tsv_process, #tsv_rows, #tsv_rows_full, #wait_on

Constructor Details

#initialize(page) ⇒ Tabs

Returns a new instance of Tabs.



6
7
8
# File 'lib/rbbt/rest/common/tabs.rb', line 6

def initialize(page)
  @page = page
end

Instance Attribute Details

#classesObject

Returns the value of attribute classes.



5
6
7
# File 'lib/rbbt/rest/common/tabs.rb', line 5

def classes
  @classes
end

#codesObject

Returns the value of attribute codes.



5
6
7
# File 'lib/rbbt/rest/common/tabs.rb', line 5

def codes
  @codes
end

#contentObject

Returns the value of attribute content.



5
6
7
# File 'lib/rbbt/rest/common/tabs.rb', line 5

def content
  @content
end

#headersObject

Returns the value of attribute headers.



5
6
7
# File 'lib/rbbt/rest/common/tabs.rb', line 5

def headers
  @headers
end

#tab_classesObject

Returns the value of attribute tab_classes.



5
6
7
# File 'lib/rbbt/rest/common/tabs.rb', line 5

def tab_classes
  @tab_classes
end

Instance Method Details

#active(header = nil) ⇒ Object



27
28
29
# 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) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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