Class: RPDF::PDFArray
Overview
Array Object
- PDFRef15 p34
Direct Known Subclasses
Instance Attribute Summary collapse
-
#array ⇒ Object
readonly
Returns the value of attribute array.
Attributes inherited from PDFObject
#generation_number, #object_number
Instance Method Summary collapse
- #<<(element) ⇒ Object
-
#initialize(array, document = nil) ⇒ PDFArray
constructor
A new instance of PDFArray.
- #to_s ⇒ Object
Methods inherited from PDFObject
#indirect?, #invalidate, #invalidated?, #to_pdf, #to_ref
Constructor Details
#initialize(array, document = nil) ⇒ PDFArray
Returns a new instance of PDFArray.
11 12 13 14 15 16 17 18 |
# File 'lib/rpdf/pdfarray.rb', line 11 def initialize(array, document=nil) raise Exception.new("PDFArray is not an array") unless array.kind_of?(Array) @array = Array.new array.each { |object| @array << RPDF.topdfobject(object, document) } super(document) end |
Instance Attribute Details
#array ⇒ Object (readonly)
Returns the value of attribute array.
9 10 11 |
# File 'lib/rpdf/pdfarray.rb', line 9 def array @array end |
Instance Method Details
#<<(element) ⇒ Object
20 21 22 |
# File 'lib/rpdf/pdfarray.rb', line 20 def <<(element) @array << RPDF.topdfobject(element) end |
#to_s ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/rpdf/pdfarray.rb', line 24 def to_s bytes = "[ " @array.each { |element| bytes << element.to_ref # to_ref -> reference to indirect object bytes << " " } bytes << "]" end |