lib/rnp/rnp.rb in rnp-1.0.2 vs lib/rnp/rnp.rb in rnp-1.0.3
- old
+ new
@@ -250,11 +250,11 @@
armored: nil,
compression: nil,
creation_time: nil,
expiration_time: nil,
hash: nil)
- default_output(output) do |output_|
+ Output.default(output) do |output_|
sign = start_sign(input: input, output: output_)
sign.options = {
armored: armored,
compression: compression,
creation_time: creation_time,
@@ -278,11 +278,11 @@
def cleartext_sign(input:, output: nil, signers:,
compression: nil,
creation_time: nil,
expiration_time: nil,
hash: nil)
- default_output(output) do |output_|
+ Output.default(output) do |output_|
sign = start_cleartext_sign(input: input, output: output_)
sign.options = {
compression: compression,
creation_time: creation_time,
expiration_time: expiration_time,
@@ -307,11 +307,11 @@
armored: nil,
compression: nil,
creation_time: nil,
expiration_time: nil,
hash: nil)
- default_output(output) do |output_|
+ Output.default(output) do |output_|
sign = start_detached_sign(input: input, output: output_)
sign.options = {
armored: armored,
compression: compression,
creation_time: creation_time,
@@ -351,11 +351,11 @@
# @param cipher (see Encrypt#cipher=)
def encrypt(input:, output: nil, recipients:,
armored: nil,
compression: nil,
cipher: nil)
- default_output(output) do |output_|
+ Output.default(output) do |output_|
enc = start_encrypt(input: input, output: output_)
enc.options = {
armored: armored,
compression: compression,
cipher: cipher
@@ -381,11 +381,11 @@
compression: nil,
cipher: nil,
hash: nil,
creation_time: nil,
expiration_time: nil)
- default_output(output) do |output_|
+ Output.default(output) do |output_|
enc = start_encrypt(input: input, output: output_)
enc.options = {
armored: armored,
compression: compression,
cipher: cipher,
@@ -415,11 +415,11 @@
compression: nil,
cipher: nil,
s2k_hash: nil,
s2k_iterations: 0,
s2k_cipher: nil)
- default_output(output) do |output_|
+ Output.default(output) do |output_|
enc = start_encrypt(input: input, output: output_)
enc.options = {
armored: armored,
compression: compression,
cipher: cipher
@@ -440,11 +440,11 @@
# @param input [Input] the input to read the encrypted data
# @param output [Output] the output to write the decrypted data.
# If nil, the result will be returned directly as a String.
# @return [nil, String]
def decrypt(input:, output: nil)
- default_output(output) do |output_|
+ Output.default(output) do |output_|
Rnp.call_ffi(:rnp_decrypt, @ptr, input.ptr, output_.ptr)
end
end
# Create a {Sign} operation.
@@ -581,15 +581,8 @@
def load_save_flags(public_keys:, secret_keys:)
flags = 0
flags |= LibRnp::RNP_LOAD_SAVE_PUBLIC_KEYS if public_keys
flags |= LibRnp::RNP_LOAD_SAVE_SECRET_KEYS if secret_keys
flags
- end
-
- def default_output(output)
- to_str = output.nil?
- output = Output.to_string if to_str
- yield output
- output.string if to_str
end
end # class