Class: RPDF::PDFNumeric

Inherits:
PDFObject show all
Includes:
Comparable
Defined in:
lib/rpdf/pdfnumeric.rb

Overview

Numeric Object

PDFRef15 p28

Direct Known Subclasses

PDFInteger

Instance Attribute Summary collapse

Attributes inherited from PDFObject

#generation_number, #object_number

Instance Method Summary collapse

Methods inherited from PDFObject

#indirect?, #invalidate, #invalidated?, #to_pdf, #to_ref

Constructor Details

#initialize(value, document = nil) ⇒ PDFNumeric

Returns a new instance of PDFNumeric.

Raises:

  • (Exception)


12
13
14
15
16
# File 'lib/rpdf/pdfnumeric.rb', line 12

def initialize(value, document=nil)
  raise Exception.new("PDFNumeric is not a number") unless value.kind_of?(Numeric)
  @value = value
  super(document)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10
11
12
# File 'lib/rpdf/pdfnumeric.rb', line 10

def value
  @value
end

Instance Method Details

#<=>(other) ⇒ Object



18
19
20
# File 'lib/rpdf/pdfnumeric.rb', line 18

def <=>(other)
  @value <=> other.value
end

#to_sObject



22
23
24
# File 'lib/rpdf/pdfnumeric.rb', line 22

def to_s
  @value.to_s
end