Method: Origami::Real.parse

Defined in:
lib/origami/numeric.rb

.parse(stream, _parser = nil) ⇒ Object

:nodoc:



158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/origami/numeric.rb', line 158

def self.parse(stream, _parser = nil) #:nodoc:
    offset = stream.pos

    if not stream.scan(@@regexp)
        raise InvalidRealObjectError, "Invalid real number format"
    end

    value = stream['real'].to_f
    real = Real.new(value)
    real.file_offset = offset

    real
end