Sha256: 627372a9c8d579b0268b94a1b0adb6e9c9a9fe2c0f744e3978c985837cc127c0

Contents?: true

Size: 671 Bytes

Versions: 4

Compression:

Stored size: 671 Bytes

Contents

# frozen_string_literal: true

module Lite
  module Command
    module Internals
      module Fault

        def self.included(base)
          base.class_eval do
            attr_reader :caused_by, :thrown_by
          end
        end

        def caused_fault?
          caused_by == self
        end

        def threw_fault?
          thrown_by == self
        end

        def thrown?
          fault? && !caused_fault?
        end

        private

        def throw!(command)
          return if command.success?

          send(:"#{command.status}!", command)
        end

        def raise_dynamic_faults?
          false
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lite-command-2.1.3 lib/lite/command/internals/fault.rb
lite-command-2.1.2 lib/lite/command/internals/fault.rb
lite-command-2.1.1 lib/lite/command/internals/fault.rb
lite-command-2.1.0 lib/lite/command/internals/fault.rb