Class: DesignSystem::Components::Tab

Inherits:
Object
  • Object
show all
Defined in:
lib/design_system/components/tab.rb

Overview

This class helps to design Tab component

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view_context = nil) ⇒ Tab

Returns a new instance of Tab.



9
10
11
12
# File 'lib/design_system/components/tab.rb', line 9

def initialize(view_context = nil)
  @view_context = view_context
  @tabs = []
end

Instance Attribute Details

#tabsObject

Returns the value of attribute tabs.



7
8
9
# File 'lib/design_system/components/tab.rb', line 7

def tabs
  @tabs
end

#titleObject

Returns the value of attribute title.



7
8
9
# File 'lib/design_system/components/tab.rb', line 7

def title
  @title
end

Instance Method Details

#add_tab_panel(name, content, id = nil, selected: false, &block) ⇒ Object



14
15
16
17
# File 'lib/design_system/components/tab.rb', line 14

def add_tab_panel(name, content, id = nil, selected: false, &block)
  content ||= @view_context.capture(&block) if block_given?
  @tabs << [name, content, id, selected]
end