Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class VU
- include Comparable
- attr :volume
- def initialize(volume) # 0..9
- @volume = volume
- end
- def inspect
- '#' * @volume
- end
- # Support for ranges
- def <=>(other)
- self.volume <=> other.volume
- end
- def succ
- raise(IndexError, "Volume too big") if @volume >= 9
- VU.new(@volume.succ)
- end
- end
Add Comment
Please, Sign In to add comment