asker-tool 2.9.1 → 2.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b66d61db280ca9eef5c1e855a03ef378f72e149b344908119a67e782f4cf3c64
4
- data.tar.gz: bf10658b63f02184fa4e5896439372b87e22e1423631048815372f2edaaee4af
3
+ metadata.gz: 712f5ef9ce3683bd737c09a109538f58f88c1b39dd5fed4ac158325466729978
4
+ data.tar.gz: cab2e91c8cd046384af546ff43032e2cb4cfb91fa432067b65466c4944e1daba
5
5
  SHA512:
6
- metadata.gz: 92e28ef3a63c291e857b56d8836b9d4152018b1e48d7cdb52286a2afcb949317a24c503c6206702785a9137b42cac23c4c5e4cfb3eb89850329776efc8450d7c
7
- data.tar.gz: 4270447ac41b16e5e5cf14bf31ebd9af84f4ad559b27546ba00efd92b71f297b0598f0ab9bf0bd646613fc07d815d25ea79b59d3e1bb9d037b5a9f718485e5d6
6
+ metadata.gz: c0d011842fc510437fb7a484eb4c4580aff74b15864063cfbde57ecf495c79dd2bec0fb277dbebf1556d2519617cb0e8169a31929ea6346a5be46db01cac6850
7
+ data.tar.gz: f3cee25561d9d81808459b0bff0b91eee376c69d2ee2db637cdffb0c70927f94a66e56bca5addbf2b1f31a109d2013a6451bd4b1efbfad6f991b424733c462a4
@@ -17,7 +17,7 @@ class JavascriptCodeAI < BaseCodeAI
17
17
  lines[index].sub!("//", "").strip!
18
18
 
19
19
  q = Question.new(:short)
20
- q.name = "#{name}-#{num}-uncomment"
20
+ q.name = "#{name}-#{num}-code1uncomment"
21
21
  q.text = @lang.text_for(:code1, lines_to_html(lines))
22
22
  q.shorts << (index + 1)
23
23
  q.feedback = "Comment symbol removed"
@@ -27,7 +27,7 @@ class JavascriptCodeAI < BaseCodeAI
27
27
  lines[index] = "// " + lines[index]
28
28
 
29
29
  q = Question.new(:short)
30
- q.name = "#{name}-#{num}-comment"
30
+ q.name = "#{name}-#{num}-code1comment"
31
31
  q.text = @lang.text_for(:code1, lines_to_html(lines))
32
32
  q.shorts << (index + 1)
33
33
  q.feedback = "Comment symbol added"
@@ -54,14 +54,14 @@ class JavascriptCodeAI < BaseCodeAI
54
54
  lines.insert(index, " " * (rand(4).to_i + 1))
55
55
  if @lines.size < 4 || rand(2) == 0
56
56
  q = Question.new(:short)
57
- q.name = "#{name}-#{num}-codeok"
57
+ q.name = "#{name}-#{num}-code1ok"
58
58
  q.text = @lang.text_for(:code1, lines_to_html(lines))
59
59
  q.shorts << "0"
60
60
  q.feedback = "Code is OK"
61
61
  questions << q
62
62
  else
63
63
  q = Question.new(:choice)
64
- q.name = "#{name}-#{num}-codeok"
64
+ q.name = "#{name}-#{num}-code1ok"
65
65
  q.text = @lang.text_for(:code2, lines_to_html(lines))
66
66
  others = (1..@lines.size).to_a.shuffle!
67
67
  q.good = "0"
@@ -91,13 +91,13 @@ class JavascriptCodeAI < BaseCodeAI
91
91
  lines[index].sub!(key.to_s, value)
92
92
  if @lines.size < 4 || rand(2) == 0
93
93
  q = Question.new(:short)
94
- q.name = "#{name}-#{num}-syntaxerror"
94
+ q.name = "#{name}-#{num}-code1syntaxerror"
95
95
  q.text = @lang.text_for(:code1, lines_to_html(lines))
96
96
  q.shorts << (index + 1)
97
97
  q.feedback = "Syntax error: '#{value}' must be '#{key}'"
98
98
  else
99
99
  q = Question.new(:choice)
100
- q.name = "#{name}-#{num}-syntaxerror"
100
+ q.name = "#{name}-#{num}-code1syntaxerror"
101
101
  q.text = @lang.text_for(:code2, lines_to_html(lines))
102
102
  others = (1..@lines.size).to_a.shuffle!
103
103
  others.delete(index + 1)
@@ -139,13 +139,13 @@ class JavascriptCodeAI < BaseCodeAI
139
139
 
140
140
  if rand(2) == 0
141
141
  q = Question.new(:short)
142
- q.name = "#{name}-#{num}-variable"
142
+ q.name = "#{name}-#{num}-code1variable"
143
143
  q.text = @lang.text_for(:code1, lines_to_html(lines))
144
144
  q.shorts << (index + 1)
145
145
  q.feedback = "Variable error! Swapped lines #{index + 1} with #{k + 1}"
146
146
  else
147
147
  q = Question.new(:choice)
148
- q.name = "#{name}-#{num}-variable"
148
+ q.name = "#{name}-#{num}-code1variable"
149
149
  q.text = @lang.text_for(:code2, lines_to_html(lines))
150
150
  others = (1..@lines.size).to_a.shuffle!
151
151
  others.delete(index + 1)
@@ -17,7 +17,7 @@ class PythonCodeAI < BaseCodeAI
17
17
  lines[index].sub!("#", "").strip!
18
18
 
19
19
  q = Question.new(:short)
20
- q.name = "#{name}-#{num}-uncomment"
20
+ q.name = "#{name}-#{num}-code1uncomment"
21
21
  q.text = @lang.text_for(:code1, lines_to_html(lines))
22
22
  q.shorts << (index + 1)
23
23
  q.feedback = "Comment symbol removed"
@@ -27,7 +27,7 @@ class PythonCodeAI < BaseCodeAI
27
27
  lines[index] = "# " + lines[index]
28
28
 
29
29
  q = Question.new(:short)
30
- q.name = "#{name}-#{num}-comment"
30
+ q.name = "#{name}-#{num}-code1comment"
31
31
  q.text = @lang.text_for(:code1, lines_to_html(lines))
32
32
  q.shorts << (index + 1)
33
33
  q.feedback = "Comment symbol added"
@@ -54,14 +54,14 @@ class PythonCodeAI < BaseCodeAI
54
54
  lines.insert(index, " " * (rand(4).to_i + 1))
55
55
  if @lines.size < 4 || rand(2) == 0
56
56
  q = Question.new(:short)
57
- q.name = "#{name}-#{num}-codeok"
57
+ q.name = "#{name}-#{num}-code1ok"
58
58
  q.text = @lang.text_for(:code1, lines_to_html(lines))
59
59
  q.shorts << "0"
60
60
  q.feedback = "Code is OK"
61
61
  questions << q
62
62
  else
63
63
  q = Question.new(:choice)
64
- q.name = "#{name}-#{num}-codeok"
64
+ q.name = "#{name}-#{num}-code1ok"
65
65
  q.text = @lang.text_for(:code2, lines_to_html(lines))
66
66
  others = (1..@lines.size).to_a.shuffle!
67
67
  q.good = "0"
@@ -91,13 +91,13 @@ class PythonCodeAI < BaseCodeAI
91
91
  lines[index].sub!(key.to_s, value)
92
92
  if @lines.size < 4 || rand(2) == 0
93
93
  q = Question.new(:short)
94
- q.name = "#{name}-#{num}-syntaxerror"
94
+ q.name = "#{name}-#{num}-code1syntaxerror"
95
95
  q.text = @lang.text_for(:code1, lines_to_html(lines))
96
96
  q.shorts << (index + 1)
97
97
  q.feedback = "Syntax error: '#{value}' must be '#{key}'"
98
98
  else
99
99
  q = Question.new(:choice)
100
- q.name = "#{name}-#{num}-syntaxerror"
100
+ q.name = "#{name}-#{num}-code1syntaxerror"
101
101
  q.text = @lang.text_for(:code2, lines_to_html(lines))
102
102
  others = (1..@lines.size).to_a.shuffle!
103
103
  others.delete(index + 1)
@@ -139,13 +139,13 @@ class PythonCodeAI < BaseCodeAI
139
139
 
140
140
  if rand(2) == 0
141
141
  q = Question.new(:short)
142
- q.name = "#{name}-#{num}-variable"
142
+ q.name = "#{name}-#{num}-code1variable"
143
143
  q.text = @lang.text_for(:code1, lines_to_html(lines))
144
144
  q.shorts << (index + 1)
145
145
  q.feedback = "Variable error! Swapped lines #{index + 1} with #{k + 1}"
146
146
  else
147
147
  q = Question.new(:choice)
148
- q.name = "#{name}-#{num}-variable"
148
+ q.name = "#{name}-#{num}-code1variable"
149
149
  q.text = @lang.text_for(:code2, lines_to_html(lines))
150
150
  others = (1..@lines.size).to_a.shuffle!
151
151
  others.delete(index + 1)
@@ -21,7 +21,7 @@ class RubyCodeAI < BaseCodeAI
21
21
  lines[index].sub!("#", "").strip!
22
22
 
23
23
  q = Question.new(:short)
24
- q.name = "#{name}-#{num}-uncomment"
24
+ q.name = "#{name}-#{num}-code1uncomment"
25
25
  q.text = @lang.text_for(:code1, lines_to_html(lines))
26
26
  q.shorts << (index + 1)
27
27
  q.feedback = "Comment symbol removed"
@@ -31,7 +31,7 @@ class RubyCodeAI < BaseCodeAI
31
31
  lines[index] = "# " + lines[index]
32
32
 
33
33
  q = Question.new(:short)
34
- q.name = "#{name}-#{num}-comment"
34
+ q.name = "#{name}-#{num}-code1comment"
35
35
  q.text = @lang.text_for(:code1, lines_to_html(lines))
36
36
  q.shorts << (index + 1)
37
37
  q.feedback = "Comment symbol added"
@@ -60,14 +60,14 @@ class RubyCodeAI < BaseCodeAI
60
60
  lines.insert(index, " " * (rand(4).to_i + 1))
61
61
  if @lines.size < 4 || rand(2) == 0
62
62
  q = Question.new(:short)
63
- q.name = "#{name}-#{num}-codeok"
63
+ q.name = "#{name}-#{num}-code1ok"
64
64
  q.text = @lang.text_for(:code1, lines_to_html(lines))
65
65
  q.shorts << "0"
66
66
  q.feedback = "Code is OK"
67
67
  questions << q
68
68
  else
69
69
  q = Question.new(:choice)
70
- q.name = "#{name}-#{num}-codeok"
70
+ q.name = "#{name}-#{num}-code1ok"
71
71
  q.text = @lang.text_for(:code2, lines_to_html(lines))
72
72
  others = (1..@lines.size).to_a.shuffle!
73
73
  q.good = "0"
@@ -99,13 +99,13 @@ class RubyCodeAI < BaseCodeAI
99
99
  lines[index].sub!(key.to_s, value)
100
100
  if @lines.size < 4 || rand(2) == 0
101
101
  q = Question.new(:short)
102
- q.name = "#{name}-#{num}-syntaxerror"
102
+ q.name = "#{name}-#{num}-code1syntaxerror"
103
103
  q.text = @lang.text_for(:code1, lines_to_html(lines))
104
104
  q.shorts << (index + 1)
105
105
  q.feedback = "Syntax error: '#{value}' must be '#{key}'"
106
106
  else
107
107
  q = Question.new(:choice)
108
- q.name = "#{name}-#{num}-syntaxerror"
108
+ q.name = "#{name}-#{num}-code1syntaxerror"
109
109
  q.text = @lang.text_for(:code2, lines_to_html(lines))
110
110
  others = (1..@lines.size).to_a.shuffle!
111
111
  others.delete(index + 1)
@@ -149,13 +149,13 @@ class RubyCodeAI < BaseCodeAI
149
149
 
150
150
  if rand(2) == 0
151
151
  q = Question.new(:short)
152
- q.name = "#{name}-#{num}-variable"
152
+ q.name = "#{name}-#{num}-code1variable"
153
153
  q.text = @lang.text_for(:code1, lines_to_html(lines))
154
154
  q.shorts << (index + 1)
155
155
  q.feedback = "Variable error! Swapped lines #{index + 1} with #{k + 1}"
156
156
  else
157
157
  q = Question.new(:choice)
158
- q.name = "#{name}-#{num}-variable"
158
+ q.name = "#{name}-#{num}-code1variable"
159
159
  q.text = @lang.text_for(:code2, lines_to_html(lines))
160
160
  others = (1..@lines.size).to_a.shuffle!
161
161
  others.delete(index + 1)
@@ -35,7 +35,17 @@ class Customizer
35
35
  end
36
36
 
37
37
  def bin2dec(value)
38
- value.to_s.to_i(2)
38
+ value.to_s.to_i(2).to_s
39
+ end
40
+
41
+ def bin2hex(value)
42
+ dec = bin2dec(value)
43
+ dec2hex(dec)
44
+ end
45
+
46
+ def bin2oct(value)
47
+ dec = bin2dec(value)
48
+ dec2oct(dec)
39
49
  end
40
50
 
41
51
  def dec2bin(value)
@@ -45,4 +55,36 @@ class Customizer
45
55
  def dec2hex(value)
46
56
  value.to_i.to_s(16)
47
57
  end
58
+
59
+ def dec2oct(value)
60
+ value.to_i.to_s(8).to_s
61
+ end
62
+
63
+ def hex2bin(value)
64
+ dec = hex2dec(value)
65
+ dec2bin(dec)
66
+ end
67
+
68
+ def hex2dec(value)
69
+ value.to_s.to_i(16).to_s
70
+ end
71
+
72
+ def hex2oct(value)
73
+ dec = hex2dec(value)
74
+ dec2oct(dec)
75
+ end
76
+
77
+ def oct2bin(value)
78
+ dec = oct2dec(value)
79
+ dec2bin(dec)
80
+ end
81
+
82
+ def oct2dec(value)
83
+ value.to_s.to_i(8).to_s
84
+ end
85
+
86
+ def oct2hex(value)
87
+ dec = oct2dec(value)
88
+ dec2hex(dec)
89
+ end
48
90
  end
@@ -62,33 +62,5 @@ category =
62
62
  ; Accept Comma separated strings.
63
63
  exclude =
64
64
 
65
- ; ### stage_b ###
66
- ; b1: b1match4x4, b1match3x1misspelled, b1match3x1
67
- ; ### stage_d ###
68
- ; d1: d1choose, d1none, d1none-misspelled
69
- ; d2: d2def-mispelled, d2name-mispelled, d2true, d2false-misspelled
70
- ; d3: d3hidden
71
- ; d4: d4filtered
72
- ; ### stage_f
73
- ; f1: f1true, f1short, f1name-misspelled, f1true-misspelled, f1false
74
- ; f2: f2outsider
75
- ; f3: f3filtered
76
- ; ### stage_i
77
- ; i1
78
- ; i2
79
- ; i3
80
- ; i4
81
- ; ### stage_s
82
- ; s1
83
- ; ### stage_t
84
- ; t1table
85
- ; t2table
86
- ; t3table
87
- ; t4table
88
- ; t5table
89
- ; t6table
90
- ; t7table
91
- ; t8table
92
- ; t9table
93
- ; ### code
94
- ; code1
65
+ ; Question ID list:
66
+ ; https://github.com/teuton-software/asker/blob/master/docs/questions.md
data/lib/asker/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  class Asker
2
- VERSION = "2.9.1"
2
+ VERSION = "2.9.3"
3
3
  NAME = "asker"
4
4
  GEM = "asker-tool"
5
5
  CONFIGFILE = "asker.ini"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asker-tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.1
4
+ version: 2.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Vargas Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-01 00:00:00.000000000 Z
11
+ date: 2023-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml