Class: Tabster::Configurable::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/tabster/configurable.rb

Overview

Holds all the parameters for the Tabster initializer and defaults that should suite most needs. It’s possible to overwrite those as well. This class is passed through the block running on the Tabster module.

Defined Under Namespace

Classes: ConfigurationError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



15
16
17
# File 'lib/tabster/configurable.rb', line 15

def initialize
 initialize_tab_set!
end

Instance Attribute Details

#tab_setObject

Returns the value of attribute tab_set.



13
14
15
# File 'lib/tabster/configurable.rb', line 13

def tab_set
  @tab_set
end

Instance Method Details

#configuration_pathObject



42
43
44
# File 'lib/tabster/configurable.rb', line 42

def configuration_path
  "#{RAILS_ROOT}/config/initializers/tabacious.rb"
end

#draw {|@tab_set| ... } ⇒ Object

add class methods to return tabnavs self.class_eval

define_method

end

Yields:



33
34
35
36
# File 'lib/tabster/configurable.rb', line 33

def draw
  yield @tab_set
  @tab_set
end

#initialize_tab_set!Object



19
20
21
# File 'lib/tabster/configurable.rb', line 19

def initialize_tab_set!
  @tab_set = TabSet.new
end

#reloadObject

Reload the tab ordering



24
25
26
# File 'lib/tabster/configurable.rb', line 24

def reload
  @tab_set = tab_set.nil? ? nil : tab_set
end

#validate!Object

Raises:



38
39
40
# File 'lib/tabster/configurable.rb', line 38

def validate!
  raise ConfigurationError.new("Tab navigation needs name as a String or Symbol \n e.i. config.name = :admin") unless self.name.is_a? String or self.name.is_a? Symbol
end