Class: RPDF::PDFString
Overview
String Object
- PDFRef15 p29
Instance Attribute Summary collapse
-
#hexadecimal ⇒ Object
Returns the value of attribute hexadecimal.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from PDFObject
#generation_number, #object_number
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(value, document = nil) ⇒ PDFString
constructor
A new instance of PDFString.
- #to_s ⇒ Object
Methods inherited from PDFObject
#indirect?, #invalidate, #invalidated?, #to_pdf, #to_ref
Constructor Details
#initialize(value, document = nil) ⇒ PDFString
Returns a new instance of PDFString.
12 13 14 15 16 17 |
# File 'lib/rpdf/pdfstring.rb', line 12 def initialize(value, document=nil) raise Exception.new("PDFString is not a string") unless value.kind_of?(String) @value = value @hexadecimal = false super(document) end |
Instance Attribute Details
#hexadecimal ⇒ Object
Returns the value of attribute hexadecimal.
10 11 12 |
# File 'lib/rpdf/pdfstring.rb', line 10 def hexadecimal @hexadecimal end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
8 9 10 |
# File 'lib/rpdf/pdfstring.rb', line 8 def value @value end |
Instance Method Details
#==(other) ⇒ Object
19 20 21 |
# File 'lib/rpdf/pdfstring.rb', line 19 def ==(other) @value == other.value end |
#to_s ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rpdf/pdfstring.rb', line 23 def to_s if @hexadecimal # [PDFRef15 p32] hexval = String.new @value.each_byte { |byte| hexval << "%02X" % byte } "<#{hexval}>" else "(#{@value.dump})" # nonprinting characters should be replaced by \nnn and special characters escaped end end |