Sha256: f583c244254f7fc6d61e69330471124441f6eb0d3da50f31eef557d99ae91e33
Contents?: true
Size: 1.32 KB
Versions: 15
Compression:
Stored size: 1.32 KB
Contents
module Vedeu module Input # Stores each keypress or command to be retrieved later. # class Store def initialize end # @return [Hash<Symbol => Array<Symbol|String>>] def add_command(command) all_commands << command end # @return [Hash<Symbol => Array<Symbol|String>>] def add_keypress(keypress) all_keypresses << keypress end # @return [Hash<Symbol => Array<Symbol|String>>] def all storage end # @return [Array<Symbol|String>] def all_commands storage[:commands] end # @return [Array<Symbol|String>] def all_keypresses storage[:keypresses] end # @return [NilClass|Symbol|String] def last_command all_commands[-1] end # @return [NilClass|Symbol|String] def last_keypress all_keypresses[-1] end # @return [Hash<Symbol => Array<Symbol|String>>] def reset @storage = in_memory end private # @return [Hash<Symbol => Array<Symbol|String>>] def storage @storage ||= in_memory end # @return [Hash<Symbol => Array<Symbol|String>>] def in_memory { commands: [], keypresses: [], } end end # Store end # Input end # Vedeu
Version data entries
15 entries across 15 versions & 1 rubygems