Module: Lite::Command::Internals::Faultable

Defined in:
lib/lite/command/internals/faultable.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



8
9
10
11
12
# File 'lib/lite/command/internals/faultable.rb', line 8

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

Instance Method Details

#caused_fault?Boolean



20
21
22
# File 'lib/lite/command/internals/faultable.rb', line 20

def caused_fault?
  caused_by == self
end

#reason?(str) ⇒ Boolean



14
15
16
17
18
# File 'lib/lite/command/internals/faultable.rb', line 14

def reason?(str)
  return true if str.nil?

  reason == str
end

#threw_fault?Boolean



24
25
26
# File 'lib/lite/command/internals/faultable.rb', line 24

def threw_fault?
  thrown_by == self
end

#thrown?Boolean



28
29
30
# File 'lib/lite/command/internals/faultable.rb', line 28

def thrown?
  fault? && !caused_fault?
end