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 28 29 30
class VM
class Char
def initialize(code)
@code = code
end
def self.from_string(str)
new(str.ord)
end
def raw
@code
end
def ==(other)
return false unless other.is_a?(Char)
raw == other.raw
end
alias eq? ==
def to_s
@code.chr
end
def to_ruby
@code.chr
end
end
end