Class: Prawn::Reference
- Inherits:
-
Object
- Object
- Prawn::Reference
- Defined in:
- lib/prawn/reference.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#gen ⇒ Object
Returns the value of attribute gen.
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#stream ⇒ Object
readonly
Returns the value of attribute stream.
Instance Method Summary collapse
- #<<(data) ⇒ Object
-
#initialize(id, data) ⇒ Reference
constructor
A new instance of Reference.
- #object ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(id, data) ⇒ Reference
Returns a new instance of Reference.
16 17 18 19 20 |
# File 'lib/prawn/reference.rb', line 16 def initialize(id,data) @identifier = id @gen = 0 @data = data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
13 14 15 |
# File 'lib/prawn/reference.rb', line 13 def data @data end |
#gen ⇒ Object
Returns the value of attribute gen.
13 14 15 |
# File 'lib/prawn/reference.rb', line 13 def gen @gen end |
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
14 15 16 |
# File 'lib/prawn/reference.rb', line 14 def identifier @identifier end |
#offset ⇒ Object
Returns the value of attribute offset.
13 14 15 |
# File 'lib/prawn/reference.rb', line 13 def offset @offset end |
#stream ⇒ Object (readonly)
Returns the value of attribute stream.
14 15 16 |
# File 'lib/prawn/reference.rb', line 14 def stream @stream end |
Instance Method Details
#<<(data) ⇒ Object
31 32 33 |
# File 'lib/prawn/reference.rb', line 31 def <<(data) (@stream ||= "") << data end |
#object ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/prawn/reference.rb', line 22 def object output = "#{@identifier} #{gen} obj\n" << Prawn::PdfObject(data) << "\n" if @stream output << "stream\n" << @stream << "\nendstream\n" end output << "endobj\n" end |
#to_s ⇒ Object
35 36 37 |
# File 'lib/prawn/reference.rb', line 35 def to_s "#{@identifier} #{gen} R" end |