blob: 9c8d113e24bcc0e1256b44e95565b023093250dc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
module RandomSpecs
CustomRangeInteger = Struct.new(:value) do
def to_int; value; end
def <=>(other); to_int <=> other.to_int; end
def -(other); self.class.new(to_int - other.to_int); end
def +(other); self.class.new(to_int + other.to_int); end
end
CustomRangeFloat = Struct.new(:value) do
def to_f; value; end
def <=>(other); to_f <=> other.to_f; end
def -(other); to_f - other.to_f; end
def +(other); self.class.new(to_f + other.to_f); end
end
end
|