class Rapinoe::Slide

‘Slide` is a really vague approximation. Keynote stores its data in a zip-compressed file that has a bunch of .iwa files in it, which is where it stores its data. Each of those .iwa files is a file that’s been compressed with a non-standard version of Google’s Snappy compression format, and in turn the resulting data is stored in Google’s Protobuf interchange format.

I think we could probably get pretty deep into this, but I couldn’t get the Ruby Snappy bindings to decompress the .iwa data (presumably due to the lacking Stream Identifier chunk). Might be something we look into later and see how many details we can glean from the full dataset.

For more information, see @obriensp’s excellent docs:

https://github.com/obriensp/iWorkFileFormat/blob/master/Docs/index.md

For now, we’re going to instead look at the generated jpeg previews inside the ‘Data/` subdirectory. It’s a nasty approximation, but it should map fairly well to the actual number of slides in the file.

Attributes

data[RW]

The binary data representing the jpeg representation of this slide.

Public Class Methods

new(data) click to toggle source
# File lib/rapinoe/slide.rb, line 23
def initialize(data)
  @data = data
end

Public Instance Methods

inspect() click to toggle source
# File lib/rapinoe/slide.rb, line 42
def inspect
  "<Rapinoe::Slide>"
end
preview_data() click to toggle source

The contents of the preview jpeg, loaded into memory.

Returns a string of the jpeg’s binary data.

# File lib/rapinoe/slide.rb, line 30
def preview_data
  @data
end
write_preview_to_file(path) click to toggle source

Writes the preview for this slide to disk.

# File lib/rapinoe/slide.rb, line 35
def write_preview_to_file(path)
  FileUtils.mkdir_p(File.dirname(path))
  File.open(path, 'wb') do |out|
    out.write(preview_data)
  end
end