Class: ImageSize::ISOBMFF::Box

Inherits:
Object
  • Object
show all
Defined in:
lib/image_size/isobmff.rb

Overview

:nodoc:

Direct Known Subclasses

FullBox

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Box

Returns a new instance of Box.



12
13
14
15
16
17
18
# File 'lib/image_size/isobmff.rb', line 12

def initialize(attributes)
  @type = attributes.fetch(:type)
  @offset = attributes.fetch(:offset)
  @size = attributes.fetch(:size) == 0 ? nil : attributes[:size]
  @relative_data_offset = attributes.fetch(:relative_data_offset)
  @index = attributes.fetch(:index)
end

Instance Attribute Details

#indexObject (readonly)

Returns the value of attribute index.



10
11
12
# File 'lib/image_size/isobmff.rb', line 10

def index
  @index
end

#offsetObject (readonly)

Returns the value of attribute offset.



10
11
12
# File 'lib/image_size/isobmff.rb', line 10

def offset
  @offset
end

#relative_data_offsetObject (readonly)

Returns the value of attribute relative_data_offset.



10
11
12
# File 'lib/image_size/isobmff.rb', line 10

def relative_data_offset
  @relative_data_offset
end

#sizeObject (readonly)

Returns the value of attribute size.



10
11
12
# File 'lib/image_size/isobmff.rb', line 10

def size
  @size
end

#typeObject (readonly)

Returns the value of attribute type.



10
11
12
# File 'lib/image_size/isobmff.rb', line 10

def type
  @type
end

Instance Method Details

#data_offsetObject



20
21
22
# File 'lib/image_size/isobmff.rb', line 20

def data_offset
  offset + relative_data_offset
end

#data_sizeObject



24
25
26
# File 'lib/image_size/isobmff.rb', line 24

def data_size
  size ? size - relative_data_offset : nil
end