Class: Aidp::Harness::UI::Navigation::MenuState
- Inherits:
-
Object
- Object
- Aidp::Harness::UI::Navigation::MenuState
show all
- Defined in:
- lib/aidp/harness/ui/navigation/menu_state.rb
Overview
Manages navigation state and history
Defined Under Namespace
Classes: InvalidStateError, StateError
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of MenuState.
13
14
15
16
17
18
19
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 13
def initialize
@navigation_history = []
@current_menu = nil
@menu_stack = []
@breadcrumbs = []
@last_selection = nil
end
|
Instance Attribute Details
Returns the value of attribute current_menu.
88
89
90
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 88
def
@current_menu
end
|
#last_selection ⇒ Object
Returns the value of attribute last_selection.
90
91
92
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 90
def last_selection
@last_selection
end
|
Instance Method Details
#can_go_back? ⇒ Boolean
96
97
98
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 96
def can_go_back?
@menu_stack.size > 1
end
|
#clear_breadcrumbs ⇒ Object
104
105
106
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 104
def clear_breadcrumbs
@breadcrumbs.clear
end
|
#clear_history ⇒ Object
100
101
102
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 100
def clear_history
@navigation_history.clear
end
|
108
109
110
111
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 108
def
@menu_stack.clear
@current_menu = nil
end
|
#export_state ⇒ Object
120
121
122
123
124
125
126
127
128
129
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 120
def export_state
{
current_menu: @current_menu,
menu_stack: @menu_stack,
breadcrumbs: @breadcrumbs,
last_selection: @last_selection,
navigation_history: @navigation_history,
menu_depth:
}
end
|
#get_breadcrumbs ⇒ Object
80
81
82
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 80
def get_breadcrumbs
@breadcrumbs.dup
end
|
84
85
86
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 84
def
@menu_stack.dup
end
|
#get_navigation_history ⇒ Object
76
77
78
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 76
def get_navigation_history
@navigation_history.dup
end
|
92
93
94
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 92
def
@menu_stack.size
end
|
29
30
31
32
33
34
35
36
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 29
def
return nil if @menu_stack.empty?
@menu_stack.pop
@breadcrumbs.pop
@current_menu = @menu_stack.last
@current_menu
end
|
21
22
23
24
25
26
27
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 21
def ()
()
@menu_stack <<
@breadcrumbs <<
@current_menu =
end
|
#record_keyboard_navigation(key, action) ⇒ Object
60
61
62
63
64
65
66
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 60
def record_keyboard_navigation(key, action)
@navigation_history << {
menu: @current_menu,
selection: "keyboard: #{key} -> #{action}",
timestamp: Time.now
}
end
|
#record_progressive_disclosure(level, action) ⇒ Object
68
69
70
71
72
73
74
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 68
def record_progressive_disclosure(level, action)
@navigation_history << {
menu: @current_menu,
selection: "progressive: level #{level} -> #{action}",
timestamp: Time.now
}
end
|
#record_selection(selection) ⇒ Object
43
44
45
46
47
48
49
50
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 43
def record_selection(selection)
@last_selection = selection
@navigation_history << {
menu: @current_menu,
selection: selection,
timestamp: Time.now
}
end
|
#record_workflow_mode_selection(mode) ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 52
def record_workflow_mode_selection(mode)
@navigation_history << {
menu: @current_menu,
selection: "workflow_mode: #{mode}",
timestamp: Time.now
}
end
|
#reset ⇒ Object
113
114
115
116
117
118
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 113
def reset
clear_history
clear_breadcrumbs
@last_selection = nil
end
|
38
39
40
41
|
# File 'lib/aidp/harness/ui/navigation/menu_state.rb', line 38
def ()
()
@current_menu =
end
|