Module: Vedeu::Input::Store
Overview
Stores each keypress or command to be retrieved later.
Instance Method Summary collapse
-
#add_command(command) ⇒ Hash<Symbol => Array<Symbol|String>>
-
#add_keypress(keypress) ⇒ Hash<Symbol => Array<Symbol|String>>
-
#all_commands ⇒ Array<Symbol|String>
-
#all_keypresses ⇒ Array<Symbol|String>
- #in_memory ⇒ Hash<Symbol => Array<Symbol|String>> private
-
#last_command ⇒ NilClass|Symbol|String
-
#last_keypress ⇒ NilClass|Symbol|String
Methods included from Repositories::Storage
Instance Method Details
#add_command(command) ⇒ Hash<Symbol => Array<Symbol|String>>
17 18 19 |
# File 'lib/vedeu/input/store.rb', line 17 def add_command(command) all_commands << command end |
#add_keypress(keypress) ⇒ Hash<Symbol => Array<Symbol|String>>
24 25 26 |
# File 'lib/vedeu/input/store.rb', line 24 def add_keypress(keypress) all_keypresses << keypress end |
#all_commands ⇒ Array<Symbol|String>
30 31 32 |
# File 'lib/vedeu/input/store.rb', line 30 def all_commands storage[:commands] end |
#all_keypresses ⇒ Array<Symbol|String>
36 37 38 |
# File 'lib/vedeu/input/store.rb', line 36 def all_keypresses storage[:keypresses] end |
#in_memory ⇒ Hash<Symbol => Array<Symbol|String>> (private)
55 56 57 58 59 60 |
# File 'lib/vedeu/input/store.rb', line 55 def in_memory { commands: [], keypresses: [], } end |
#last_command ⇒ NilClass|Symbol|String
42 43 44 |
# File 'lib/vedeu/input/store.rb', line 42 def last_command all_commands[-1] end |
#last_keypress ⇒ NilClass|Symbol|String
48 49 50 |
# File 'lib/vedeu/input/store.rb', line 48 def last_keypress all_keypresses[-1] end |