Class: TabBuilder::TabPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/classes/tab_builder/tab_presenter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template, tab) ⇒ TabPresenter

Returns a new instance of TabPresenter.



6
7
8
9
# File 'app/classes/tab_builder/tab_presenter.rb', line 6

def initialize(template, tab)
  @tab = tab
  @template = template
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args, &block) ⇒ Object (private)



42
43
44
45
# File 'app/classes/tab_builder/tab_presenter.rb', line 42

def method_missing(*args, &block)
  return @template.send(*args, &block) if @template.respond_to?(args.first)
  super
end

Instance Attribute Details

#tabObject (readonly)

Returns the value of attribute tab.



3
4
5
# File 'app/classes/tab_builder/tab_presenter.rb', line 3

def tab
  @tab
end

Instance Method Details

#classesObject



11
12
13
# File 'app/classes/tab_builder/tab_presenter.rb', line 11

def classes
  (current? ? %w(tab current) : %w(tab)).join(" ")
end

#titleObject



15
16
17
# File 'app/classes/tab_builder/tab_presenter.rb', line 15

def title
  tab.tooltip ? tooltip : label
end