Class: Origami::Real
- Includes:
- Number
- Defined in:
- lib/origami/numeric.rb,
lib/origami/obfuscation.rb
Overview
Class representing a Real number Object. PDF real numbers are arbitrary precision numbers, depending on architectures.
Constant Summary collapse
- TOKENS =
:nodoc:
[ "(\\+|-)?([\\d]*\\.[\\d]+|[\\d]+\\.[\\d]*)([eE](\\+|-)?[\\d]+)?" ]
- REGEXP_TOKEN =
Regexp.new(TOKENS.first)
- @@regexp =
Regexp.new(WHITESPACES + "(" + TOKENS.first + ")")
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(f = 0) ⇒ Real
constructor
Creates a new Real from a Ruby Float.
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 Float
Constructor Details
Class Method Details
.parse(stream) ⇒ Object
:nodoc:
169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/origami/numeric.rb', line 169 def self.parse(stream) #:nodoc: offset = stream.pos if not stream.scan(@@regexp) raise InvalidRealObjectError, "Invalid real number format" end value = stream[2].to_f real = Real.new(value) real.file_offset = offset real end |