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

#initialize(type, content = '') ⇒ Generic



98
99
100
# File 'lib/chunky_png/chunk.rb', line 98

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

Instance Attribute Details

#contentObject

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



96
97
98
# File 'lib/chunky_png/chunk.rb', line 96

def content
  @content
end

Class Method Details

.read(type, content) ⇒ ChunkyPNG::Chunk::Generic

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



106
107
108
# File 'lib/chunky_png/chunk.rb', line 106

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