Module: Vedeu::Input::Store
Overview
Stores each keypress or command to be retrieved later.
Class 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
-
.reset! ⇒ void
(also: #reset)
extended
from Repositories::Storage
private
Remove all currently stored data for this repository.
-
.storage ⇒ void
(also: #all)
extended
from Repositories::Storage
private
Return whole repository; provides raw access to the storage for this repository.
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
Class 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 |
.reset! ⇒ void Also known as: reset Originally defined in module Repositories::Storage
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Remove all currently stored data for this repository.
.storage ⇒ void Also known as: all Originally defined in module Repositories::Storage
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Return whole repository; provides raw access to the storage for this repository.
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 |