Class: ChunkyPNG::Chunk::Generic

Inherits:
Base
  • Object
show all
Defined in:
lib/chunky_png/chunk.rb

Overview

The Generic chunk type will read the content from the chunk as it, and will write it back as it was read.

Direct Known Subclasses

ImageData, InternationalText, Palette, Transparency

Instance Attribute Summary (collapse)

Attributes inherited from Base

#type

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Base

#write, #write_with_crc

Constructor Details

- (Generic) initialize(type, content = '')

Returns a new instance of Generic



92
93
94
# File 'lib/chunky_png/chunk.rb', line 92

def initialize(type, content = '')
  super(type, :content => content)
end

Instance Attribute Details

- (Object) content

The attribute to store the content from the chunk, which gets written by the write method.



89
90
91
# File 'lib/chunky_png/chunk.rb', line 89

def content
  @content
end

Class Method Details

+ (ChunkyPNG::Chunk::Generic) read(type, content)

Creates an instance, given the chunk's type and content.

Parameters:

  • type (String)

    The four character chunk type indicator.

  • content (String)

    The content read from the chunk.

Returns:



100
101
102
# File 'lib/chunky_png/chunk.rb', line 100

def self.read(type, content)
  self.new(type, content)
end