Class: Origami::Integer
- Inherits:
-
Integer
- Object
- Integer
- 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 + "(?<int>(\\+|-)?[\\d]+)")
Instance Attribute Summary
Attributes included from Object
#file_offset, #generation, #no, #objstm_offset, #parent
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(i = 0) ⇒ Integer
constructor
Creates a new Integer from a Ruby Fixnum / Bignum.
Methods included from Number
#&, #*, #**, #+, #-, #-@, #/, #<<, #>>, #^, #abs, #to_s, #|, #~
Methods included from Object
#<=>, #cast_to, #copy, #document, #export, included, #indirect?, #indirect_parent, #logicalize, #logicalize!, #native_type, #post_build, #pre_build, #reference, #set_document, #set_indirect, skip_until_next_obj, #solve, #to_o, #to_s, #type, typeof, #version_required, #xrefs
Constructor Details
#initialize(i = 0) ⇒ Integer
Creates a new Integer from a Ruby Fixnum / Bignum.
- i
-
The Integer value.
106 107 108 109 110 111 112 |
# File 'lib/origami/numeric.rb', line 106 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, _parser = nil) ⇒ Object
:nodoc:
114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/origami/numeric.rb', line 114 def self.parse(stream, _parser = nil) #:nodoc: offset = stream.pos if not stream.scan(@@regexp) raise InvalidIntegerObjectError, "Invalid integer format" end value = stream['int'].to_i int = Integer.new(value) int.file_offset = offset int end |