Class: Origami::Integer
- Includes:
- Number
- Defined in:
- lib/origami/numeric.rb,
lib/origami/obfuscation.rb
Overview
Class representing an Integer Object.
Constant Summary collapse
- TOKENS =
:nodoc:
[ "(\\+|-)?[\\d]+[^.]?" ]
- REGEXP_TOKEN =
Regexp.new(TOKENS.first)
- @@regexp =
Regexp.new(WHITESPACES + "((\\+|-)?[\\d]+)")
Instance Attribute Summary
Attributes included from Object
#file_offset, #generation, #no, #objstm_offset, #parent
Class Method Summary collapse
-
.parse(stream) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(i = 0) ⇒ Integer
constructor
Creates a new Integer from a Ruby Fixnum / Bignum.
Methods included from Number
#&, #*, #**, #+, #-, #-@, #/, #<<, #>>, #^, #abs, #real_type, #to_s, #|, #~
Methods included from Object
#<=>, #copy, #indirect_parent, #is_indirect?, #pdf, #pdf_version_required, #post_build, #pre_build, #reference, #set_indirect, #set_pdf, #size, skip_until_next_obj, #solve, #to_o, #to_s, #type, typeof, #xrefs
Methods inherited from Bignum
Constructor Details
#initialize(i = 0) ⇒ Integer
Creates a new Integer from a Ruby Fixnum / Bignum.
- i
-
The Integer value.
111 112 113 114 115 116 117 118 |
# File 'lib/origami/numeric.rb', line 111 def initialize(i = 0) unless i.is_a?(::Integer) raise TypeError, "Expected type Fixnum or Bignum, received #{i.class}." end super(i) end |
Class Method Details
.parse(stream) ⇒ Object
:nodoc:
120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/origami/numeric.rb', line 120 def self.parse(stream) #:nodoc: offset = stream.pos if not stream.scan(@@regexp) raise InvalidIntegerObjectError, "Invalid integer format" end value = stream[2].to_i int = Integer.new(value) int.file_offset = offset int end |