Sha256: 53e7f2d82db5ef5ecbb5b60189dc759db6a1b0254d0650ec6bf162324c739d72
Contents?: true
Size: 1.13 KB
Versions: 3
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true 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 = {}) do_before(opts) do_around(opts) do |updated_opts| builder = configure_command(instantiate_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(_); end def configure_command(builder, _opts) builder end def do_around(opts) yield opts end def do_after(_) Result.new end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruby_gpg2-0.11.0.pre.4 | lib/ruby_gpg2/commands/base.rb |
ruby_gpg2-0.11.0.pre.3 | lib/ruby_gpg2/commands/base.rb |
ruby_gpg2-0.11.0.pre.2 | lib/ruby_gpg2/commands/base.rb |