Class: Lite::Command::FaultStreamer
- Inherits:
-
Object
- Object
- Lite::Command::FaultStreamer
- Defined in:
- lib/lite/command/fault_streamer.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #caused_by ⇒ Object
-
#initialize(command, object) ⇒ FaultStreamer
constructor
A new instance of FaultStreamer.
- #metadata ⇒ Object
- #reason ⇒ Object
- #thrown_by ⇒ Object
Constructor Details
#initialize(command, object) ⇒ FaultStreamer
Returns a new instance of FaultStreamer.
9 10 11 12 |
# File 'lib/lite/command/fault_streamer.rb', line 9 def initialize(command, object) @command = command @object = object end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
7 8 9 |
# File 'lib/lite/command/fault_streamer.rb', line 7 def command @command end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
7 8 9 |
# File 'lib/lite/command/fault_streamer.rb', line 7 def object @object end |
Instance Method Details
#caused_by ⇒ Object
14 15 16 |
# File 'lib/lite/command/fault_streamer.rb', line 14 def caused_by Utils.try(object, :caused_by) || command end |
#metadata ⇒ Object
24 25 26 |
# File 'lib/lite/command/fault_streamer.rb', line 24 def Utils.try(object, :metadata) || command. end |
#reason ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/lite/command/fault_streamer.rb', line 28 def reason if object.respond_to?(:reason) object.reason elsif object.is_a?(StandardError) "[#{object.class.name}] #{object.}".chomp(".") else object end end |