Sha256: 0a2a5ad9f97a57f0390b943019b5c7bfc42372aa69ee35b1be9d3beffba0e7fe
Contents?: true
Size: 1.23 KB
Versions: 6
Compression:
Stored size: 1.23 KB
Contents
require 'lino' require_relative './result' module RubyGPG2 module Commands class Base def initialize(binary: nil, stdin: nil, stdout: nil, stderr: nil) @binary = binary || RubyGPG2.configuration.binary @stdin = stdin || RubyGPG2.configuration.stdin @stdout = stdout || RubyGPG2.configuration.stdout @stderr = stderr || RubyGPG2.configuration.stderr end def execute(opts = {}) builder = instantiate_builder do_before(opts) do_around(opts) do |updated_opts| builder = configure_command(builder, updated_opts) builder .build .execute( stdin: stdin, stdout: stdout, stderr: stderr) end do_after(opts) end protected attr_reader :binary, :stdin, :stdout, :stderr def instantiate_builder Lino::CommandLineBuilder .for_command(binary) .with_option_separator('=') end def do_before(opts) end def configure_command(builder, opts) builder end def do_around(opts) yield opts end def do_after(opts) Result.new end end end end
Version data entries
6 entries across 6 versions & 1 rubygems