Class: Goose::State

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

Instance Method Summary collapse

Constructor Details

#initialize(view) ⇒ State

Returns a new instance of State.



5
6
7
8
# File 'lib/goose/state.rb', line 5

def initialize(view)
  @view = view
  @stack ||= []
end

Instance Method Details

#at?(place) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/goose/state.rb', line 14

def at?(place)
  current_address.at?(place)
end


18
19
20
# File 'lib/goose/state.rb', line 18

def breadcrumbs
  current_address.breadcrumbs
end

#current_addressObject



22
23
24
# File 'lib/goose/state.rb', line 22

def current_address
  @stack.last
end

#render(nav, address) ⇒ Object



10
11
12
# File 'lib/goose/state.rb', line 10

def render(nav, address)
  at(nav, address) { @view.render(:partial => "nav/#{nav}") }
end