Module: InputLists
- Included in:
- Keyboard
- Defined in:
- tomes/conjurations/keyboard/input_lists.rb
Overview
A module containing all the sets of input presses used by the Keyboard class and its modules.
Instance Method Summary collapse
- 
  
    
      #alphabet  ⇒ Array<Symbols> 
    
    
  
  
  
  
  
  
  
  
  
    A list of alphabet symbols. 
- 
  
    
      #button_inputs  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    All controller-style buttons as a Hash with mixed values. 
- 
  
    
      #common_punctuation  ⇒ Array<Symbols> 
    
    
  
  
  
  
  
  
  
  
  
    A list of common_punctuation symbols. 
- 
  
    
      #confirm_button_inputs  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    A hash of common confirm/deny buttons. 
- 
  
    
      #direction_inputs  ⇒ Hash<Array> 
    
    
  
  
  
  
  
  
  
  
  
    The directional arrows or WASD keys as a hash of arrays containing both options. 
- 
  
    
      #enclosing_punctuation  ⇒ Array<Symbols> 
    
    
  
  
  
  
  
  
  
  
  
    A list of enclosing_punctuation symbols. 
- 
  
    
      #keys  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    All other lists in this module merged into one. 
- 
  
    
      #letter_inputs  ⇒ Array 
    
    
  
  
  
  
  
  
  
  
  
    Any key that is not a number or directional arrow. 
- 
  
    
      #number_inputs  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    All ten number keys as a hash. 
- 
  
    
      #uncommon_punctuation  ⇒ Array<Symbols> 
    
    
  
  
  
  
  
  
  
  
  
    A list of uncommon_punctuation symbols. 
Instance Method Details
#alphabet ⇒ Array<Symbols>
A list of alphabet symbols.
| 7 8 9 10 11 12 13 14 15 16 | # File 'tomes/conjurations/keyboard/input_lists.rb', line 7 def alphabet %i[ a b c d e f g h i j k l m n o p q r s t u v w x y z ] end | 
#button_inputs ⇒ Hash
Directions are included.
All controller-style buttons as a Hash with mixed values.
| 83 84 85 86 87 88 89 90 91 92 | # File 'tomes/conjurations/keyboard/input_lists.rb', line 83 def { A: %i[c j], B: %i[x k], X: %i[z l], Y: %i[shift semicolon], START: :enter, SELECT: :space }.merge(directions) end | 
#common_punctuation ⇒ Array<Symbols>
A list of common_punctuation symbols.
| 20 21 22 23 24 25 26 | # File 'tomes/conjurations/keyboard/input_lists.rb', line 20 def common_punctuation %i[ comma period exclamation_mark question_mark colon semicolon less_than greater_than equal space enter shift tab backspace ] end | 
#confirm_button_inputs ⇒ Hash
A hash of common confirm/deny buttons.
| 97 98 99 100 101 102 | # File 'tomes/conjurations/keyboard/input_lists.rb', line 97 def { yes: %i[j enter c], no: %i[k x] } end | 
#direction_inputs ⇒ Hash<Array>
The directional arrows or WASD keys as a hash of arrays containing both options.
| 70 71 72 73 74 75 76 77 | # File 'tomes/conjurations/keyboard/input_lists.rb', line 70 def direction_inputs { up: %i[up_arrow w], down: %i[down_arrow s], left: %i[left_arrow a], right: %i[right_arrow d] } end | 
#enclosing_punctuation ⇒ Array<Symbols>
A list of enclosing_punctuation symbols.
| 39 40 41 42 43 44 | # File 'tomes/conjurations/keyboard/input_lists.rb', line 39 def enclosing_punctuation %i[ open_square_brace close_square_brace open_round_brace close_round_brace single_quotation_mark double_quotation_mark ] end | 
#keys ⇒ Hash
This method has not been tested!
All other lists in this module merged into one.
| 107 108 109 | # File 'tomes/conjurations/keyboard/input_lists.rb', line 107 def keys letter_inputs.to_h + number_inputs + direction_inputs + + end | 
#letter_inputs ⇒ Array
Any key that is not a number or directional arrow.
| 48 49 50 51 52 53 | # File 'tomes/conjurations/keyboard/input_lists.rb', line 48 def letter_inputs alphabet + common_punctuation + uncommon_punctuation + enclosing_punctuation end | 
#number_inputs ⇒ Hash
All ten number keys as a hash.
| 57 58 59 60 61 62 63 64 65 | # File 'tomes/conjurations/keyboard/input_lists.rb', line 57 def number_inputs { one: 1, two: 2, three: 3, four: 4, five: 5, six: 6, seven: 7, eight: 8, nine: 9, zero: 0 } end | 
#uncommon_punctuation ⇒ Array<Symbols>
A list of uncommon_punctuation symbols.
| 30 31 32 33 34 35 | # File 'tomes/conjurations/keyboard/input_lists.rb', line 30 def uncommon_punctuation %i[ meta alt control forward_slash back_slash ] end |