Module: Cryptum::UI::Matrix

Defined in:
lib/cryptum/ui/matrix.rb

Overview

This plugin is used as a visual representation of being in a, “Red Pill” state

Class Method Summary collapse

Class Method Details

.generate(opts = {}) ⇒ Object

Supported Method Parameters

Cryptum::Matrix.generate(

cols: cols

)



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/cryptum/ui/matrix.rb', line 14

public_class_method def self.generate(opts = {})
  # Need to divide by two for wide characters
  cols = opts[:cols].to_i

  matrix_arr = [
    "\u30a0",
    "\u30a1",
    "\u30a2",
    "\u30a3",
    "\u30a4",
    "\u30a5",
    "\u30a6",
    "\u30a7",
    "\u30a8",
    "\u30a9",
    "\u30aa",
    "\u30ab",
    "\u30ac",
    "\u30ad",
    "\u30ae",
    "\u30af",
    "\u30b0",
    "\u30b1",
    "\u30b2",
    "\u30b3",
    "\u30b4",
    "\u30b5",
    "\u30b6",
    "\u30b7",
    "\u30b8",
    "\u30b9",
    "\u30ba",
    "\u30bb",
    "\u30bc",
    "\u30bd",
    "\u30be",
    "\u30bf",
    "\u30c0",
    "\u30c1",
    "\u30c2",
    "\u30c3",
    "\u30c4",
    "\u30c5",
    "\u30c6",
    "\u30c7",
    "\u30c8",
    "\u30c9",
    "\u30ca",
    "\u30cb",
    "\u30cc",
    "\u30cd",
    "\u30ce",
    "\u30cf",
    "\u30d0",
    "\u30d1",
    "\u30d2",
    "\u30d3",
    "\u30d4",
    "\u30d5",
    "\u30d6",
    "\u30d7",
    "\u30d8",
    "\u30d9",
    "\u30da",
    "\u30db",
    "\u30dc",
    "\u30dd",
    "\u30de",
    "\u30df",
    "\u30e0",
    "\u30e1",
    "\u30e2",
    "\u30e3",
    "\u30e4",
    "\u30e5",
    "\u30e6",
    "\u30e7",
    "\u30e8",
    "\u30e9",
    "\u30ea",
    "\u30eb",
    "\u30ec",
    "\u30ed",
    "\u30ee",
    "\u30ef",
    "\u30f0",
    "\u30f1",
    "\u30f2",
    "\u30f3",
    "\u30f4",
    "\u30f5",
    "\u30f6",
    "\u30f7",
    "\u30f8",
    "\u30f9",
    "\u30fa",
    "\u30fb",
    "\u30fc",
    "\u30fd",
    "\u30fe",
    '0 ',
    '1 ',
    '2 ',
    '3 ',
    '4 ',
    '5 ',
    '6 ',
    '7 ',
    '8 ',
    '9 ',
    'A ',
    'c ',
    'R ',
    'y ',
    'P ',
    't ',
    'U ',
    'm ',
    'x ',
    'Z ',
    ': ',
    '{ ',
    '[ ',
    '} ',
    '] ',
    '| ',
    '` ',
    '~ ',
    '! ',
    '@ ',
    '# ',
    '$ ',
    '% ',
    '^ ',
    '& ',
    '* ',
    '( ',
    ') ',
    '_ ',
    '- ',
    '= ',
    '+ ',
    '> ',
    '< ',
    '. ',
    ', '
  ]

  matrix_row = ''
  most_cols = cols - 1
  most_cols.times.each do
    matrix_row += "#{matrix_arr.sample} "
  end
  matrix_row += matrix_arr.sample
rescue Interrupt, StandardError => e
  Cryptum::Log.append(level: :error, msg: e, which_self: self)
end

.helpObject

Display Usage for this Module



174
175
176
177
178
# File 'lib/cryptum/ui/matrix.rb', line 174

public_class_method def self.help
  puts "USAGE:
    matrix_row = #{self}.generate(cols: Curses.cols)
  "
end