Method: Origami::PPKLite::Header.parse

Defined in:
lib/origami/extensions/ppklite.rb

.parse(stream) ⇒ Object

:nodoc:



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/origami/extensions/ppklite.rb', line 68

def self.parse(stream) #:nodoc:
    if not stream.scan(MAGIC).nil?
        maj = stream['major'].to_i
        min = stream['minor'].to_i
    else
        raise InvalidHeader, "Invalid header format"
    end

    stream.skip(REGEXP_WHITESPACES)

    PPKLite::Header.new(maj, min)
end