lib/chunky_png/datastream.rb in chunky_png-0.9.0 vs lib/chunky_png/datastream.rb in chunky_png-0.9.1

- old
+ new

@@ -35,11 +35,10 @@ # The empty chunk that signals the end of this datastream # @return [ChunkyPNG::Chunk::Header] attr_accessor :end_chunk - # Initializes a new Datastream instance. def initialize @other_chunks = [] @data_chunks = [] end @@ -92,10 +91,11 @@ # Verifies that the current stream is a PNG datastream by checking its signature. # # This method reads the PNG signature from the stream, setting the current position # of the stream directly after the signature, where the IHDR chunk should begin. # + # @param [IO] io The stream to read the PNG signature from. # @raise [RuntimeError] An exception is raised if the PNG signature is not found at # the beginning of the stream. def verify_signature!(io) signature = io.read(ChunkyPNG::Datastream::SIGNATURE.length) unless signature == ChunkyPNG::Datastream::SIGNATURE @@ -131,9 +131,10 @@ def chunks enum_for(:each_chunk) end # Returns all the textual metadata key/value pairs as hash. + # @return [Hash] A hash containing metadata fields and their values. def metadata metadata = {} other_chunks.select do |chunk| metadata[chunk.keyword] = chunk.value if chunk.respond_to?(:keyword) end