File tree 2 files changed +14
-0
lines changed
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ def add_to_point(other)
83
83
raise "Failed to add #{ inspect } to #{ other . inspect } : No addition rules matched."
84
84
end
85
85
86
+ # (see #add_to_point)
87
+ alias_method :+ , :add_to_point
88
+
86
89
# Returns the additive inverse of the point.
87
90
#
88
91
# @return (Point)
@@ -123,6 +126,9 @@ def multiply_by_scalar(i)
123
126
result
124
127
end
125
128
129
+ # (see #multiply_by_scalar)
130
+ alias_method :* , :multiply_by_scalar
131
+
126
132
# Compares this point to another.
127
133
#
128
134
# @return (true or false) true if the points are equal
Original file line number Diff line number Diff line change 21
21
it 'complains if the argument is negative' do
22
22
expect { group . generator . multiply_by_scalar ( -3 ) } . to raise_error ArgumentError , 'Scalar is negative.'
23
23
end
24
+
25
+ it 'is aliased to :*' do
26
+ expect ( group . generator . method ( :* ) ) . to eq group . generator . method ( :multiply_by_scalar )
27
+ end
24
28
end
25
29
26
30
describe '#coords' do
63
67
expect ( group . generator . add_to_point ( group . generator ) ) . to eq group . generator . double
64
68
end
65
69
end
70
+
71
+ it 'is aliased to :+' do
72
+ expect ( group . generator . method ( :+ ) ) . to eq group . generator . method ( :add_to_point )
73
+ end
66
74
end
67
75
68
76
describe '#negate' do
You can’t perform that action at this time.
0 commit comments