Class: SimpleNavigation::Configuration::Builder

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

Overview

Simple Navigation configuration builder

Defined Under Namespace

Classes: Navigation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBuilder

Returns a new instance of Builder.



146
147
148
# File 'lib/simple_navigation.rb', line 146

def initialize
  self.navigations = []
end

Instance Attribute Details

Returns the value of attribute navigations.



144
145
146
# File 'lib/simple_navigation.rb', line 144

def navigations
  @navigations
end

#prefixObject

Returns the value of attribute prefix.



144
145
146
# File 'lib/simple_navigation.rb', line 144

def prefix
  @prefix
end

Instance Method Details

#buildObject

Render new navigation



159
160
161
# File 'lib/simple_navigation.rb', line 159

def build
  { :navigations => navigations }
end

Create a new navigation

Yields:



151
152
153
154
155
156
# File 'lib/simple_navigation.rb', line 151

def navigation(name, options = {}, &block)
  options.merge!(:i18n => false) unless options.has_key?(:i18n)
  navigation = Navigation.new(name, options)
  yield navigation
  self.navigations << navigation.build
end