Sha256: b5dca79b4b68079718b39ce14913d7fb6e3b81eaa3f1ce6cc792c64dbe184909

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

require 'avm/eac_asciidoctor_base0/logging/catcher'
require 'eac_cli/core_ext'

module Avm
  module EacAsciidoctorBase0
    module Sources
      module Runners
        module IgnoreErrorsOption
          common_concern do
            acts_as_abstract :run_without_rescue

            include ::EacCli::Runner
            runner_definition do
              bool_opt '-g', '--ignore-errors'
            end
          end

          # @return [Boolean]
          delegate :ignore_errors?, to: :parsed

          # @return [void]
          def run
            catcher_send { run_without_rescue }
          rescue ::Avm::EacAsciidoctorBase0::Logging::Error => e
            fatal_error e
          end

          protected

          # @return [Proc]
          def catcher_send(&block)
            if ignore_errors?
              block.call
            else
              ::Avm::EacAsciidoctorBase0::Logging::Catcher.on(&block)
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
avm-eac_asciidoctor_base0-0.25.0 lib/avm/eac_asciidoctor_base0/sources/runners/ignore_errors_option.rb
eac_tools-0.97.0 sub/avm-eac_asciidoctor_base0/lib/avm/eac_asciidoctor_base0/sources/runners/ignore_errors_option.rb