Sha256: 395826e79a5a9f9de8f567b84f94af30890f3f87339ff663668aaa84412223a2
Contents?: true
Size: 685 Bytes
Versions: 64
Compression:
Stored size: 685 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] == ?\1 end end class LittleEndianGuard < SpecGuard def pattern [1].pack('L') end private :pattern def match? pattern[-1] == ?\0 end end class Object def big_endian g = BigEndianGuard.new g.name = :big_endian yield if g.yield? ensure g.unregister end def little_endian g = LittleEndianGuard.new g.name = :little_endian yield if g.yield? ensure g.unregister end end
Version data entries
64 entries across 64 versions & 1 rubygems