Class: ImageSize::ISOBMFF::Box
- Inherits:
-
Object
- Object
- ImageSize::ISOBMFF::Box
- Defined in:
- lib/image_size/isobmff.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#relative_data_offset ⇒ Object
readonly
Returns the value of attribute relative_data_offset.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #data_offset ⇒ Object
- #data_size ⇒ Object
-
#initialize(attributes) ⇒ Box
constructor
A new instance of Box.
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
#index ⇒ Object (readonly)
Returns the value of attribute index.
10 11 12 |
# File 'lib/image_size/isobmff.rb', line 10 def index @index end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
10 11 12 |
# File 'lib/image_size/isobmff.rb', line 10 def offset @offset end |
#relative_data_offset ⇒ Object (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 |
#size ⇒ Object (readonly)
Returns the value of attribute size.
10 11 12 |
# File 'lib/image_size/isobmff.rb', line 10 def size @size end |
#type ⇒ Object (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_offset ⇒ Object
20 21 22 |
# File 'lib/image_size/isobmff.rb', line 20 def data_offset offset + relative_data_offset end |
#data_size ⇒ Object
24 25 26 |
# File 'lib/image_size/isobmff.rb', line 24 def data_size size ? size - relative_data_offset : nil end |