Class: Origami::Adobe::PPKLite::Header
- Inherits:
-
Object
- Object
- Origami::Adobe::PPKLite::Header
- Defined in:
- lib/origami/extensions/ppklite.rb
Overview
Class representing a certificate store header.
Constant Summary collapse
- MAGIC =
/\A%PPKLITE-(\d)\.(\d)/
Instance Attribute Summary collapse
-
#majorversion ⇒ Object
Returns the value of attribute majorversion.
-
#minorversion ⇒ Object
Returns the value of attribute minorversion.
Class Method Summary collapse
-
.parse(stream) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(majorversion = 2, minorversion = 1) ⇒ Header
constructor
Creates a file header, with the given major and minor versions.
-
#to_f ⇒ Object
:nodoc:.
-
#to_s ⇒ Object
Outputs self into PDF code.
-
#to_sym ⇒ Object
:nodoc:.
Constructor Details
#initialize(majorversion = 2, minorversion = 1) ⇒ Header
Creates a file header, with the given major and minor versions.
- majorversion
-
Major version.
- minorversion
-
Minor version.
64 65 66 |
# File 'lib/origami/extensions/ppklite.rb', line 64 def initialize(majorversion = 2, minorversion = 1) @majorversion, @minorversion = majorversion, minorversion end |
Instance Attribute Details
#majorversion ⇒ Object
Returns the value of attribute majorversion.
57 58 59 |
# File 'lib/origami/extensions/ppklite.rb', line 57 def majorversion @majorversion end |
#minorversion ⇒ Object
Returns the value of attribute minorversion.
57 58 59 |
# File 'lib/origami/extensions/ppklite.rb', line 57 def minorversion @minorversion end |
Class Method Details
.parse(stream) ⇒ Object
:nodoc:
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/origami/extensions/ppklite.rb', line 68 def self.parse(stream) #:nodoc: if not stream.scan(MAGIC).nil? maj = stream[1].to_i min = stream[2].to_i else raise InvalidHeader, "Invalid header format" end PPKLite::Header.new(maj,min) end |
Instance Method Details
#to_f ⇒ Object
:nodoc:
91 92 93 |
# File 'lib/origami/extensions/ppklite.rb', line 91 def to_f #:nodoc: to_sym.to_s.to_f end |
#to_s ⇒ Object
Outputs self into PDF code.
83 84 85 |
# File 'lib/origami/extensions/ppklite.rb', line 83 def to_s "%PPKLITE-#{@majorversion}.#{@minorversion}" + EOL end |
#to_sym ⇒ Object
:nodoc:
87 88 89 |
# File 'lib/origami/extensions/ppklite.rb', line 87 def to_sym #:nodoc: "#{@majorversion}.#{@minorversion}".to_sym end |