Class: Facades::Patterns::Tabs::TabPanel
- Inherits:
-
Object
- Object
- Facades::Patterns::Tabs::TabPanel
- Defined in:
- lib/facades/patterns/tabs.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(title, options = {}) ⇒ TabPanel
constructor
A new instance of TabPanel.
- #tab_id ⇒ Object
Constructor Details
#initialize(title, options = {}) ⇒ TabPanel
Returns a new instance of TabPanel.
57 58 59 60 61 62 |
# File 'lib/facades/patterns/tabs.rb', line 57 def initialize(title, = {}) @title, @options = title, @options.merge!(:id => tab_id) klasses = @options.delete(:class) || "" @options.merge!(:class => klasses.split(" ").push("tab").join(" ")) end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
55 56 57 |
# File 'lib/facades/patterns/tabs.rb', line 55 def @options end |
#title ⇒ Object
Returns the value of attribute title.
55 56 57 |
# File 'lib/facades/patterns/tabs.rb', line 55 def title @title end |
Instance Method Details
#tab_id ⇒ Object
64 65 66 67 68 |
# File 'lib/facades/patterns/tabs.rb', line 64 def tab_id return [:id] if [:id] value = title.mb_chars.normalize(:kd).gsub(/[^\x00-\x7F]/n, '').to_s value.gsub(/[']+/, '').gsub(/\W+/, ' ').strip.downcase.gsub(" ", "_") end |