lib/daybreak/record.rb in daybreak-0.0.1 vs lib/daybreak/record.rb in daybreak-0.0.2

- old
+ new

@@ -14,11 +14,12 @@ def initialize(key = nil, data = nil) @key = key @data = data end - # Read a record from an open io source, check the CRC, and set @key and @data + # Read a record from an open io source, check the CRC, and set <tt>@key</tt> + # and <tt>@data</tt>. # @param [#read] io an IO instance to read from def read(io) lock io do @key = read_bytes(io) @data = read_bytes(io) @@ -26,10 +27,10 @@ raise CorruptDataError, "CRC mismatch #{crc} should be #{crc_string}" unless crc == crc_string end self end - # The serialized representation of the key value pair plus the CRC + # The serialized representation of the key value pair plus the CRC. # @return [String] def representation raise UnnacceptableDataError, "key and data must be defined" if @key.nil? || @data.nil? byte_string + crc_string end