Method: Navgate#initialize
- Defined in:
- lib/navgate.rb
#initialize {|_self| ... } ⇒ Navgate
Returns a new instance of Navgate.
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/navgate.rb', line 102 def initialize self.controllers = Rails.application.routes.routes.map do |route| route.defaults[:controller] end.uniq.compact yield(self) 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 |