Class: Tabster::Tab
- Inherits:
-
Object
- Object
- Tabster::Tab
- Defined in:
- lib/tabster/tab.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#path ⇒ Object
Returns the value of attribute path.
-
#tabs ⇒ Object
Returns the value of attribute tabs.
Instance Method Summary collapse
- #add_tab(name, options, &block) ⇒ Object
- #extract_tabs(collection = []) ⇒ Object
- #freeze ⇒ Object
-
#initialize(options = {}, &block) ⇒ Tab
constructor
A new instance of Tab.
Constructor Details
#initialize(options = {}, &block) ⇒ Tab
Returns a new instance of Tab.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/tabster/tab.rb', line 11 def initialize( = {}, &block) puts " SEGMENTS IN TAB: #{options.inspect}" if block_given? @tabs = TabSet.new puts "BLOCK: #{block.inspect}" yield @tabs end @path = [:path_to] || '/' @highlight = [:highlights_on] || '' @priority = [:priority] || 1 end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/tabster/tab.rb', line 4 def name @name end |
#path ⇒ Object
Returns the value of attribute path.
3 4 5 |
# File 'lib/tabster/tab.rb', line 3 def path @path end |
#tabs ⇒ Object
Returns the value of attribute tabs.
5 6 7 |
# File 'lib/tabster/tab.rb', line 5 def tabs @tabs end |
Instance Method Details
#add_tab(name, options, &block) ⇒ Object
25 26 27 |
# File 'lib/tabster/tab.rb', line 25 def add_tab(name, , &block) Tabnav.new.add_tab(name, , &block) end |
#extract_tabs(collection = []) ⇒ Object
29 30 31 32 |
# File 'lib/tabster/tab.rb', line 29 def extract_tabs(collection = []) return nil unless collection.is_a? Array collection.map { |item| self.new( { :title => item.title, :path => item.path }) } end |
#freeze ⇒ Object
34 35 36 |
# File 'lib/tabster/tab.rb', line 34 def freeze self end |