~tim/scheme-vm

ref: 6276f397c829732a84c5ed8c87ba3253e0370267 scheme-vm/vm/char.rb -rw-r--r-- 330 bytes
6276f397Tim Morgan Update code style 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
class VM
  class Char
    def initialize(char)
      @byte = char.ord
    end

    def raw
      @byte
    end

    def ==(other)
      return false unless other.is_a?(Char)
      raw == other.raw
    end

    alias eq? ==
    alias eqv? ==

    def to_s
      @byte.chr
    end

    def to_ruby
      @byte.chr
    end
  end
end