Class: ZPNG::Chunk::ZTXT
- Inherits:
-
ZPNG::Chunk
- Object
- ZPNG::Chunk
- ZPNG::Chunk::ZTXT
- Defined in:
- lib/zpng/chunk.rb
Instance Attribute Summary collapse
-
#comp_method ⇒ Object
Returns the value of attribute comp_method.
-
#keyword ⇒ Object
Returns the value of attribute keyword.
-
#text ⇒ Object
Returns the value of attribute text.
Attributes inherited from ZPNG::Chunk
#crc, #data, #idx, #size, #type
Instance Method Summary collapse
-
#initialize(*args) ⇒ ZTXT
constructor
A new instance of ZTXT.
- #inspect ⇒ Object
Methods inherited from ZPNG::Chunk
#crc_ok?, #export, #export_data, from_stream
Constructor Details
#initialize(*args) ⇒ ZTXT
Returns a new instance of ZTXT.
232 233 234 235 236 237 238 |
# File 'lib/zpng/chunk.rb', line 232 def initialize *args super @keyword,@comp_method,@text = data.unpack('Z*Ca*') if @text @text = Zlib::Inflate.inflate(@text) end end |
Instance Attribute Details
#comp_method ⇒ Object
Returns the value of attribute comp_method.
231 232 233 |
# File 'lib/zpng/chunk.rb', line 231 def comp_method @comp_method end |
#keyword ⇒ Object
Returns the value of attribute keyword.
231 232 233 |
# File 'lib/zpng/chunk.rb', line 231 def keyword @keyword end |
#text ⇒ Object
Returns the value of attribute text.
231 232 233 |
# File 'lib/zpng/chunk.rb', line 231 def text @text end |
Instance Method Details
#inspect ⇒ Object
239 240 241 242 243 244 245 246 247 |
# File 'lib/zpng/chunk.rb', line 239 def inspect super.sub(/ *>$/,'') + ", " + (instance_variables-[:@type, :@crc, :@data, :@size]). map do |var| t = instance_variable_get(var).to_s t = t[0..10] + "..." if t.size > 10 "#{var.to_s.tr('@','')}=#{t}" end.join(", ") + ">" end |