Sha256: ecc1a3ee7de47fc1bba205c31c11302adba3f65f48eab4d98768f77ae046f8da
Contents?: true
Size: 1.19 KB
Versions: 20
Compression:
Stored size: 1.19 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) 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
20 entries across 20 versions & 1 rubygems