Class: RPDF::PDFBoolean

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

Overview

Boolean Object: true or false

PDFRef15 p28

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) ⇒ PDFBoolean

Returns a new instance of PDFBoolean.

Raises:

  • (Exception)


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

def initialize(value, document=nil)
  raise Exception.new("PDFBoolean not true nor false") unless (value.kind_of?(TrueClass) or value.kind_of?(FalseClass))
  @value = value
  super(document)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#<=>(other) ⇒ Object



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

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

#to_sObject



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

def to_s
  @value.to_s
end