Class: OpenPGP::Packet::LiteralData
- Inherits:
-
OpenPGP::Packet
- Object
- OpenPGP::Packet
- OpenPGP::Packet::LiteralData
- Defined in:
- lib/openpgp/packet.rb
Overview
OpenPGP Literal Data packet (tag 11).
Constant Summary collapse
- EYES_ONLY =
'_CONSOLE'
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#format ⇒ Object
Returns the value of attribute format.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Attributes inherited from OpenPGP::Packet
Class Method Summary collapse
Instance Method Summary collapse
- #eyes_only! ⇒ Object
- #eyes_only? ⇒ Boolean
-
#initialize(options = {}, &block) ⇒ LiteralData
constructor
A new instance of LiteralData.
- #write_body(buffer) ⇒ Object
Methods inherited from OpenPGP::Packet
#body, for, parse, parse_new_format, parse_old_format, tag
Constructor Details
#initialize(options = {}, &block) ⇒ LiteralData
Returns a new instance of LiteralData.
359 360 361 362 363 364 365 366 367 |
# File 'lib/openpgp/packet.rb', line 359 def initialize( = {}, &block) defaults = { :format => :b, :filename => "", :timestamp => 0, :data => "", } super(defaults.merge(), &block) end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
347 348 349 |
# File 'lib/openpgp/packet.rb', line 347 def data @data end |
#filename ⇒ Object
Returns the value of attribute filename.
347 348 349 |
# File 'lib/openpgp/packet.rb', line 347 def filename @filename end |
#format ⇒ Object
Returns the value of attribute format.
347 348 349 |
# File 'lib/openpgp/packet.rb', line 347 def format @format end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
347 348 349 |
# File 'lib/openpgp/packet.rb', line 347 def @timestamp end |
Class Method Details
.parse_body(body, options = {}) ⇒ Object
349 350 351 352 353 354 355 356 357 |
# File 'lib/openpgp/packet.rb', line 349 def self.parse_body(body, = {}) defaults = { :format => body.read_byte.chr.to_sym, :filename => body.read_string, :timestamp => body., :data => body.read, } self.new(defaults.merge()) end |
Instance Method Details
#eyes_only! ⇒ Object
378 |
# File 'lib/openpgp/packet.rb', line 378 def eyes_only!() filename = EYES_ONLY end |
#eyes_only? ⇒ Boolean
379 |
# File 'lib/openpgp/packet.rb', line 379 def eyes_only?() filename == EYES_ONLY end |
#write_body(buffer) ⇒ Object
369 370 371 372 373 374 |
# File 'lib/openpgp/packet.rb', line 369 def write_body(buffer) buffer.write_byte(format) buffer.write_string(filename) buffer.() buffer.write(data.to_s) end |