Class: Pnjson::Chunk
- Inherits:
-
Object
- Object
- Pnjson::Chunk
- Defined in:
- lib/pnjson/chunk.rb
Constant Summary collapse
- CRITICAL_CHUNKS_TYPES =
%w( IHDR PLTE IDAT IEND )
- ANCILLARY_CHUNKS_TYPES =
%w(bKGD cHRM gAMA hIST iCCP iTXt pHYs sBIT sPLT sRGB sTER tEXt tIME tRNS zTXt)
Instance Attribute Summary collapse
-
#crc ⇒ Object
Returns the value of attribute crc.
-
#data ⇒ Object
Returns the value of attribute data.
-
#length ⇒ Object
Returns the value of attribute length.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Chunk
constructor
A new instance of Chunk.
- #to_hash ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Chunk
13 14 15 16 17 18 |
# File 'lib/pnjson/chunk.rb', line 13 def initialize( = {}) @length = [:length] @type = hex_to_ascii([:type]) @data = [:data] @crc = [:crc] end |
Instance Attribute Details
#crc ⇒ Object
Returns the value of attribute crc.
6 7 8 |
# File 'lib/pnjson/chunk.rb', line 6 def crc @crc end |
#data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/pnjson/chunk.rb', line 5 def data @data end |
#length ⇒ Object
Returns the value of attribute length.
3 4 5 |
# File 'lib/pnjson/chunk.rb', line 3 def length @length end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/pnjson/chunk.rb', line 4 def type @type end |
Instance Method Details
#to_hash ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/pnjson/chunk.rb', line 20 def to_hash { length: @length, type: @type, data: @data, crc: @crc } end |