Class: NavGate::Configuration
- Inherits:
-
Object
- Object
- NavGate::Configuration
- Defined in:
- lib/navgate.rb
Instance Attribute Summary collapse
-
#controllers ⇒ Object
Returns the value of attribute controllers.
-
#ignoring ⇒ Object
Returns the value of attribute ignoring.
-
#navs ⇒ Object
Returns the value of attribute navs.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #post_setup ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
21 22 23 24 25 26 |
# File 'lib/navgate.rb', line 21 def initialize self.controllers = Rails.application.routes.routes.map do |route| route.defaults[:controller] end.uniq.compact end |
Instance Attribute Details
#controllers ⇒ Object
Returns the value of attribute controllers.
19 20 21 |
# File 'lib/navgate.rb', line 19 def controllers @controllers end |
#ignoring ⇒ Object
Returns the value of attribute ignoring.
19 20 21 |
# File 'lib/navgate.rb', line 19 def ignoring @ignoring end |
#navs ⇒ Object
Returns the value of attribute navs.
19 20 21 |
# File 'lib/navgate.rb', line 19 def navs @navs end |
Instance Method Details
#post_setup ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/navgate.rb', line 28 def post_setup raise TypeError, "Expected Navgate:Builder or string" unless not_bad_type?(self.navs) if self.navs.is_a?(String) setup = YAML.load_file(self.navs) temp = [] setup.each do || temp.push(Navgate::Builder.new do || [:selection] = [1]['selection'].split(" ") [:default] = [1]['default'] || nill [:prefix] = [1]['prefix'] || nil [:controller] = [1]['controller'] || nil [:by_id] = [1]['by_id'] || nil [:css_class] = [1]['css_class'] || nil end ) end self.navs = temp end self.ignoring ||= [""] end |