Class: Formic::Tab

Inherits:
Base
  • Object
show all
Defined in:
lib/formic/tab.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#content, #options, #page, #template

Instance Method Summary collapse

Methods inherited from Base

#add_class, default_template, #formics, #has_class?, #initialize, #merge_options, #method_missing, template, #to_s

Constructor Details

This class inherits a constructor from Formic::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Formic::Base

Instance Attribute Details

#titleObject (readonly)

Returns the value of attribute title.



5
6
7
# File 'lib/formic/tab.rb', line 5

def title
  @title
end

Instance Method Details

#_initialize(title = '', options = {}, &block) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/formic/tab.rb', line 7

def _initialize title='', options={}, &block
  super options, &block
  @title = title
  self.tab_panel.tabs.push self
  self.options[:id] ||= "#{title.downcase.gsub(' ', '_')}_tab"
  return self
end

#tab_panelObject



15
16
17
18
19
20
21
# File 'lib/formic/tab.rb', line 15

def tab_panel
  self.formics.each do |element|
    return element if element.instance_of? Formic::TabPanel
  end

  return nil
end