Aaaargh formatting explosion! Here's that first bit all nice and unexploded.

class Fixnum                     
    def to_bytes
        if self >= -32768 && self <= 32767
            a = [0x01]
            a << ((self & 0x0000FF00) >> 8)  
            a << ((self & 0x000000FF))       
        else
            a = [0x02]                           
            a << ((self & 0xFF000000) >> 24) 
            a << ((self & 0x00FF0000) >> 16) 
            a << ((self & 0x0000FF00) >> 8)  
            a << ((self & 0x000000FF))       
        end
    end                              
end  

class Symbol
    def to_bytes
        case self
        when :+
            [0x0a]
        when :-
            [0x0b]
        when :*
            [0x0c]
        when :**
            [0x0d]
        when :/
            [0x0e]
        when :%
            [0x0f]
        end
    end

    def to_proc
        proc { |x| x.send self }
    end
end