Sha256: 11be0f90de04510cb726b60436069628956adc7f91e283925ba156a260da42d2
Contents?: true
Size: 621 Bytes
Versions: 20
Compression:
Stored size: 621 Bytes
Contents
# encoding: utf-8 module TestServer class Encoder include Comparable def name self.class.to_s.demodulize.underscore.to_sym end def encode(string) fail NotImplementedError, JSON.dump(method: 'encode') end def decode(string) fail NotImplementedError, JSON.dump(method: 'decode') end def name?(n) name == n end def eql?(other) name? other.name end def hash Digest::SHA1.hexdigest name.to_s end def <=>(other) name <=> other.name end def find_by_name(name) rescue NameError raise end end end
Version data entries
20 entries across 20 versions & 1 rubygems