PDF::Objects::Array
Inherits Indexable < Enumerable < Iterable < PDF::Objects::Base < Reference < Object
Represents a PDF array object.
PDF arrays are one-dimensional collections of objects enclosed in square brackets. Array elements can be any PDF object type, including other arrays (for multi-dimensional data).
arr = PDF::Objects::Array.new
arr << PDF::Objects::Number.new(1)
arr << PDF::Objects::Number.new(2)
arr << PDF::Objects::Number.new(3)
arr.to_pdf # => "[1 2 3]"
# Or using the convenience initializer
arr = PDF::Objects::Array.new([1, 2, 3])
arr.to_pdf # => "[1 2 3]"
Constructors
Instance methods
Returns true if this reference is the same as other. Invokes same?.
Returns true if self is empty, false otherwise.
([] of Int32).empty? # => true
([1]).empty? # => false
See Object#hash(hasher)
Serializes this object to an IO.
By default, this writes the result of #to_pdf to the IO.
Subclasses may override for more efficient streaming.
Returns the element at the given index, without doing any bounds check.
Indexable makes sure to invoke this method with index in 0...size,
so converting negative indices to positive ones is not needed here.
Clients never invoke this method directly. Instead, they access
elements with #[](index) and #[]?(index).
This method should only be directly invoked if you are absolutely sure the index is in bounds, to avoid a bounds check for a small boost of performance.