Projects

Ticket #436: test.rb

File test.rb, 273 bytes (added by macruby@…, 2 years ago)

source code

Line 
1class Test
2  attr :min
3  def initialize(min)
4    @min = min
5  end
6  def <=>(other)
7    min <=> other.min
8  end
9end
10
11class PQ < Array
12  def <<(other)
13    super other
14    sort!
15  end
16end
17
18a = Test.new(10.0)
19b = Test.new(10.1)
20d = Test.new(9.1)
21c = PQ.new
22c << a
23c << b
24c << d