Class: RbbtRESTHelpers::Tabs
- Inherits:
-
Object
- Object
- RbbtRESTHelpers::Tabs
- Defined in:
- lib/rbbt/rest/common/tabs.rb
Instance Attribute Summary collapse
-
#classes ⇒ Object
Returns the value of attribute classes.
-
#codes ⇒ Object
Returns the value of attribute codes.
-
#content ⇒ Object
Returns the value of attribute content.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#tab_classes ⇒ Object
Returns the value of attribute tab_classes.
Instance Method Summary collapse
- #active(header = nil) ⇒ Object
- #add(header = nil, code = nil, &block) ⇒ Object
-
#initialize(page) ⇒ Tabs
constructor
A new instance of Tabs.
Constructor Details
#initialize(page) ⇒ Tabs
Returns a new instance of Tabs.
5 6 7 |
# File 'lib/rbbt/rest/common/tabs.rb', line 5 def initialize(page) @page = page end |
Instance Attribute Details
#classes ⇒ Object
Returns the value of attribute classes.
4 5 6 |
# File 'lib/rbbt/rest/common/tabs.rb', line 4 def classes @classes end |
#codes ⇒ Object
Returns the value of attribute codes.
4 5 6 |
# File 'lib/rbbt/rest/common/tabs.rb', line 4 def codes @codes end |
#content ⇒ Object
Returns the value of attribute content.
4 5 6 |
# File 'lib/rbbt/rest/common/tabs.rb', line 4 def content @content end |
#headers ⇒ Object
Returns the value of attribute headers.
4 5 6 |
# File 'lib/rbbt/rest/common/tabs.rb', line 4 def headers @headers end |
#tab_classes ⇒ Object
Returns the value of attribute tab_classes.
4 5 6 |
# File 'lib/rbbt/rest/common/tabs.rb', line 4 def tab_classes @tab_classes end |
Instance Method Details
#active(header = nil) ⇒ Object
26 27 28 |
# File 'lib/rbbt/rest/common/tabs.rb', line 26 def active(header=nil) @active ||= header.nil? ? false : header end |
#add(header = nil, code = nil, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rbbt/rest/common/tabs.rb', line 9 def add(header = nil, code = nil, &block) @headers ||= [] @codes ||= {} @content ||= {} if block_given? html = @page.capture_haml &block else html = nil end @headers << header @codes[header] = code.to_s if code @content[header] = html end |