rmathguard 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rmathguard/digit.rb +1 -1
- data/lib/rmathguard/expression.rb +5 -4
- data/lib/rmathguard.rb +2 -2
- metadata +2 -2
data/lib/rmathguard/digit.rb
CHANGED
@@ -32,7 +32,7 @@ module RMathGuard
|
|
32
32
|
digit.copy(self)
|
33
33
|
digit.each_index do |row|
|
34
34
|
digit[row].each_index do |col|
|
35
|
-
digit[row][col] = PATTERN[rand(PATTERN.size)] unless digit[row][col] == 0
|
35
|
+
digit[row][col] = PATTERN[Kernel::rand(PATTERN.size)] unless digit[row][col] == 0
|
36
36
|
end
|
37
37
|
end
|
38
38
|
digit
|
@@ -9,11 +9,13 @@ module RMathGuard
|
|
9
9
|
def initialize(options = {})
|
10
10
|
@max_value = options[:max_value] || 10
|
11
11
|
@row_count = options[:row_count] || 5
|
12
|
-
@col_count = options[:col_count] || 3
|
12
|
+
@col_count = options[:col_count] || options[:column_count] || 3
|
13
13
|
@sep_size = options[:sep_size] || 2
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
unless @row_count == 5 && @col_count == 3
|
16
|
+
RMathGuard::Numbers.resize(@row_count, @col_count)
|
17
|
+
RMathGuard::Operators.resize(@row_count, @col_count)
|
18
|
+
end
|
17
19
|
generate
|
18
20
|
end
|
19
21
|
|
@@ -25,7 +27,6 @@ module RMathGuard
|
|
25
27
|
sign = o.const_get(OPERATORS[@operator]).masked
|
26
28
|
eq = o::EQUALS.masked
|
27
29
|
|
28
|
-
|
29
30
|
result = []
|
30
31
|
(0...@row_count).each do |row|
|
31
32
|
result[row] = []
|
data/lib/rmathguard.rb
CHANGED