Class: RPDF::PDFName
Overview
Name Object
- PDFRef15 p32
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Attributes inherited from PDFObject
#generation_number, #object_number
Instance Method Summary collapse
-
#eql?(other) ⇒ Boolean
To make PDFName possible to use as a key in a PDFDictionary.
- #hash ⇒ Object
-
#initialize(value, document = nil) ⇒ PDFName
constructor
A new instance of PDFName.
-
#to_s ⇒ Object
TODO: 2-digit hexadecimal code for characters outside the range 33 (!) to 126 (~) [PDFRef15 p33].
Methods inherited from PDFObject
#indirect?, #invalidate, #invalidated?, #to_pdf, #to_ref
Constructor Details
#initialize(value, document = nil) ⇒ PDFName
Returns a new instance of PDFName.
11 12 13 14 15 16 17 |
# File 'lib/rpdf/pdfname.rb', line 11 def initialize(value, document=nil) raise Exception.new("PDFName is not a string") unless value.kind_of?(String) raise Exception.new("PDFName has whitespace") if RPDF.includes_whitespace?(value) raise Exception.new("PDFName has delimiter") if RPDF.includes_delimiter?(value) @value = value super(document) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
9 10 11 |
# File 'lib/rpdf/pdfname.rb', line 9 def value @value end |
Instance Method Details
#eql?(other) ⇒ Boolean
To make PDFName possible to use as a key in a PDFDictionary
24 25 26 |
# File 'lib/rpdf/pdfname.rb', line 24 def eql?(other) @value.eql?(other.value) end |
#hash ⇒ Object
19 20 21 |
# File 'lib/rpdf/pdfname.rb', line 19 def hash @value.hash end |
#to_s ⇒ Object
TODO: 2-digit hexadecimal code for characters outside the range 33 (!) to 126 (~) [PDFRef15 p33]
29 30 31 |
# File 'lib/rpdf/pdfname.rb', line 29 def to_s "/#{@value}" end |