lib/chunky_png/datastream.rb in chunky_png-1.3.4 vs lib/chunky_png/datastream.rb in chunky_png-1.3.5

- old
+ new

@@ -129,21 +129,21 @@ # @return [Enumerable::Enumerator] An enumerator for the :each_chunk method. # @see ChunkyPNG::Datastream#each_chunk 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 metadata end - + # Returns the uncompressed image data, combined from all the IDAT chunks # @return [String] The uncompressed image data for this datastream def imagedata ChunkyPNG::Chunk::ImageData.combine_chunks(data_chunks) end @@ -173,9 +173,10 @@ # Encodes this datastream into a string. # @return [String] The encoded PNG datastream. def to_blob str = StringIO.new + str.set_encoding('ASCII-8BIT') write(str) return str.string end alias :to_string :to_blob