Module: Origami::Number

Includes:
Object
Included in:
Integer, Real
Defined in:
lib/origami/numeric.rb

Overview

Class representing a PDF number (Integer, or Real).

Defined Under Namespace

Modules: ClassMethods

Constant Summary

Constants included from Object

Object::TOKENS

Instance Attribute Summary

Attributes included from Object

#file_offset, #generation, #no, #objstm_offset, #parent

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Object

#<=>, #cast_to, #copy, #export, #indirect_parent, #initialize, #is_indirect?, #logicalize, #logicalize!, #native_type, parse, #pdf, #pdf_version_required, #post_build, #pre_build, #reference, #resolve_all_references, #set_indirect, #set_pdf, #size, skip_until_next_obj, #solve, #to_o, #type, typeof, #xrefs

Class Method Details

.included(receiver) ⇒ Object

:nodoc:



99
100
101
# File 'lib/origami/numeric.rb', line 99

def self.included(receiver) #:nodoc:
  receiver.extend(ClassMethods)
end

.native_typeObject

:nodoc:



103
# File 'lib/origami/numeric.rb', line 103

def self.native_type; Number end

Instance Method Details

#&(val) ⇒ Object



47
48
49
# File 'lib/origami/numeric.rb', line 47

def &(val)
  self.class.new(self.to_i & val)
end

#*(val) ⇒ Object



75
76
77
# File 'lib/origami/numeric.rb', line 75

def *(val)
  self.class.new(self.to_i * val)
end

#**(val) ⇒ Object



87
88
89
# File 'lib/origami/numeric.rb', line 87

def **(val)
  self.class.new(self.to_i ** val)
end

#+(val) ⇒ Object



63
64
65
# File 'lib/origami/numeric.rb', line 63

def +(val)
  self.class.new(self.to_i + val)
end

#-(val) ⇒ Object



67
68
69
# File 'lib/origami/numeric.rb', line 67

def -(val)
  self.class.new(self.to_i - val)
end

#-@Object



71
72
73
# File 'lib/origami/numeric.rb', line 71

def -@
  self.class.new(-self.to_i)
end

#/(val) ⇒ Object



79
80
81
# File 'lib/origami/numeric.rb', line 79

def /(val)
  self.class.new(self.to_i / val)
end

#<<(val) ⇒ Object



55
56
57
# File 'lib/origami/numeric.rb', line 55

def <<(val)
  self.class.new(self.to_i << val)
end

#>>(val) ⇒ Object



59
60
61
# File 'lib/origami/numeric.rb', line 59

def >>(val)
  self.class.new(self.to_i >> val)
end

#^(val) ⇒ Object



51
52
53
# File 'lib/origami/numeric.rb', line 51

def ^(val)
  self.class.new(self.to_i ^ val)
end

#absObject



83
84
85
# File 'lib/origami/numeric.rb', line 83

def abs
  self.class.new(self.to_i.abs)
end

#to_sObject



91
92
93
# File 'lib/origami/numeric.rb', line 91

def to_s
  super(value.to_s)
end

#|(val) ⇒ Object



43
44
45
# File 'lib/origami/numeric.rb', line 43

def |(val)
  self.class.new(self.to_i | val)
end

#~Object



39
40
41
# File 'lib/origami/numeric.rb', line 39

def ~
  self.class.new(~self.to_i)
end