Sha256: c589818bee3e79a43a0f8dbf0b60cc8482f636f737287a6470e282266fd060b3
Contents?: true
Size: 618 Bytes
Versions: 6
Compression:
Stored size: 618 Bytes
Contents
require 'mspec/guards/guard' # Despite that these are inverses, the two classes are # used to simplify MSpec guard reporting modes class BigEndianGuard < SpecGuard def pattern [1].pack('L') end private :pattern def match? pattern[-1] == ?\001 end end class LittleEndianGuard < SpecGuard def pattern [1].pack('L') end private :pattern def match? pattern[-1] == ?\000 end end class Object def big_endian g = BigEndianGuard.new yield if g.yield? g.unregister end def little_endian g = LittleEndianGuard.new yield if g.yield? g.unregister end end
Version data entries
6 entries across 6 versions & 1 rubygems