Class: Mobi::Header::ExthHeader::ExthRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/mobi/header/exth_header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, start) ⇒ ExthRecord

Returns a new instance of ExthRecord.



36
37
38
39
40
41
# File 'lib/mobi/header/exth_header.rb', line 36

def initialize(data, start)
  @code,   = data[start, 4].unpack('N*')[0].to_i
  @name    = ExthHeader::RECORD_TYPES[@code]
  @length, = data[start + 4, 4].unpack('N*')
  @value   = data[start + 8, length - 8]
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



34
35
36
# File 'lib/mobi/header/exth_header.rb', line 34

def code
  @code
end

#lengthObject (readonly)

Returns the value of attribute length.



34
35
36
# File 'lib/mobi/header/exth_header.rb', line 34

def length
  @length
end

#nameObject (readonly)

Returns the value of attribute name.



34
35
36
# File 'lib/mobi/header/exth_header.rb', line 34

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



34
35
36
# File 'lib/mobi/header/exth_header.rb', line 34

def value
  @value
end