Class: SimplerNavigation::Configuration

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



11
12
13
14
15
16
17
18
# File 'lib/simpler_navigation/configuration.rb', line 11

def initialize
  @selected_class = "selected"
  @active_leaf_class = "simple-navigation-active-leaf"

  if block_given?
    yield self
  end
end

Instance Attribute Details

#active_leaf_classObject

Returns the value of attribute active_leaf_class.



4
5
6
# File 'lib/simpler_navigation/configuration.rb', line 4

def active_leaf_class
  @active_leaf_class
end

#root_itemObject (readonly)

Returns the value of attribute root_item.



5
6
7
# File 'lib/simpler_navigation/configuration.rb', line 5

def root_item
  @root_item
end

#selected_classObject

Returns the value of attribute selected_class.



3
4
5
# File 'lib/simpler_navigation/configuration.rb', line 3

def selected_class
  @selected_class
end

Class Method Details

.run(&block) ⇒ Object



7
8
9
# File 'lib/simpler_navigation/configuration.rb', line 7

def self.run(&block)
  SimplerNavigation.config = new(&block)
end

Instance Method Details

#itemsObject



20
21
22
23
24
25
26
# File 'lib/simpler_navigation/configuration.rb', line 20

def items
  @root_item = Item.new(key: nil, name: nil, url: nil)

  if block_given?
    yield @root_item
  end
end