HomePhorge

A correct implementation of IO#binwrite for Ruby 1.8
4089770d3411Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

A correct implementation of IO#binwrite for Ruby 1.8

When we added the IO#binwrite method to our collection of backported
features, the specification was misinterpreted and the offset was treated as
"offset in the string we are writing".

Instead, it is an instruction to seek in the output file before writing, which
meant that our semantics were all wrong - and tests broke - when we ran
against the native binwrite on Ruby 1.9.

The new implementation is correct in behaviour on all tested cases, and has a
more extensive test suite exercising all the various parts of the behaviour
that we need.

Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>

Details

Provenance
Daniel Pittman <daniel@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPUfde0ec378666: The return type of `methods` changed in 1.9
Branches
Unknown
Tags
Unknown

Event Timeline

Daniel Pittman <daniel@puppetlabs.com> committed rPU4089770d3411: A correct implementation of IO#binwrite for Ruby 1.8 (authored by Daniel Pittman <daniel@puppetlabs.com>).Mar 30 2012, 9:15 PM