Module: RMathGuard::Numbers

Extended by:
Numbers
Included in:
Numbers
Defined in:
lib/rmathguard/number.rb

Constant Summary collapse

ZERO =
make_zero
ONE =
make_one
TWO =
make_two
THREE =
make_three
FOUR =
make_four
FIVE =
make_five
SIX =
make_six
SEVEN =
make_seven
EIGHT =
make_eight
NINE =
make_nine
@@rows =
5
@@columns =
3

Instance Method Summary collapse

Instance Method Details

#make_eightObject



82
83
84
85
86
# File 'lib/rmathguard/number.rb', line 82

def make_eight
			make_three.build do
    full_column :first
			end
end

#make_fiveObject



59
60
61
62
63
64
65
66
67
# File 'lib/rmathguard/number.rb', line 59

def make_five
			Digit.build(@@rows, @@columns) do
    full_row :top
    full_row :middle
    full_row :bottom
    half_column :top_left
    half_column :bottom_right
  end
end

#make_fourObject



51
52
53
54
55
56
57
# File 'lib/rmathguard/number.rb', line 51

def make_four
			Digit.build(@@rows, @@columns) do
    half_column :top_left
    full_row :middle
    full_column :last
			end
end

#make_nineObject



88
89
90
91
92
# File 'lib/rmathguard/number.rb', line 88

def make_nine
			make_five.build do
    full_column :last
			end
end

#make_oneObject



26
27
28
29
30
# File 'lib/rmathguard/number.rb', line 26

def make_one
			Digit.build(@@rows, @@columns) do
    full_column :last
			end
end

#make_sevenObject



75
76
77
78
79
80
# File 'lib/rmathguard/number.rb', line 75

def make_seven
			Digit.build(@@rows, @@columns) do
    full_row :top
    full_column :last
			end
end

#make_sixObject



69
70
71
72
73
# File 'lib/rmathguard/number.rb', line 69

def make_six
			make_five.build do
    full_column :first
			end
end

#make_threeObject



42
43
44
45
46
47
48
49
# File 'lib/rmathguard/number.rb', line 42

def make_three
			Digit.build(@@rows, @@columns) do
    full_row :top
    full_row :middle
    full_row :last
    full_column :last
			end
end

#make_twoObject



32
33
34
35
36
37
38
39
40
# File 'lib/rmathguard/number.rb', line 32

def make_two
			Digit.build(@@rows, @@columns) do
    full_row :top
    full_row :middle
    full_row :bottom
    half_column :top_right
    half_column :bottom_left
			end
end

#make_zeroObject



17
18
19
20
21
22
23
24
# File 'lib/rmathguard/number.rb', line 17

def make_zero
			Digit.build(@@rows, @@columns) do
    full_row :top
    full_row :bottom
    full_column :first
    full_column :last
			end
end

#resize(rows = 3, columns = 5) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/rmathguard/number.rb', line 8

def resize(rows = 3, columns = 5)
  @@rows = rows
  @@columns = columns
  constants.each do |const|
    remove_const(const)
    const_set(const, send("make_#{const.downcase}"))
  end
end