Class: ChunkyPNG::Chunk::CompressedText
- Defined in:
- lib/chunky_png/chunk.rb
Instance Attribute Summary collapse
-
#keyword ⇒ Object
Returns the value of attribute keyword.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(keyword, value) ⇒ CompressedText
constructor
A new instance of CompressedText.
Methods inherited from Base
Constructor Details
#initialize(keyword, value) ⇒ CompressedText
Returns a new instance of CompressedText.
152 153 154 155 |
# File 'lib/chunky_png/chunk.rb', line 152 def initialize(keyword, value) super('tEXt') @keyword, @value = keyword, value end |
Instance Attribute Details
#keyword ⇒ Object
Returns the value of attribute keyword.
150 151 152 |
# File 'lib/chunky_png/chunk.rb', line 150 def keyword @keyword end |
#value ⇒ Object
Returns the value of attribute value.
150 151 152 |
# File 'lib/chunky_png/chunk.rb', line 150 def value @value end |
Class Method Details
.read(type, content) ⇒ Object
157 158 159 160 161 |
# File 'lib/chunky_png/chunk.rb', line 157 def self.read(type, content) keyword, compression, value = content.unpack('Z*Ca*') raise "Compression method #{compression.inspect} not supported!" unless compression == ChunkyPNG::COMPRESSION_DEFAULT new(keyword, Zlib::Inflate.inflate(value)) end |
Instance Method Details
#content ⇒ Object
163 164 165 |
# File 'lib/chunky_png/chunk.rb', line 163 def content [keyword, ChunkyPNG::COMPRESSION_DEFAULT, Zlib::Deflate.deflate(value)].pack('Z*Ca*') end |