Class: Decouplio::ActionStatePrinter
- Inherits:
-
Object
- Object
- Decouplio::ActionStatePrinter
- Defined in:
- lib/decouplio/action_state_printer.rb
Class Method Summary collapse
- .action_context(action) ⇒ Object
- .call(action) ⇒ Object
- .meta_store(action) ⇒ Object
- .railway_flow(action) ⇒ Object
- .result(action) ⇒ Object
Class Method Details
.action_context(action) ⇒ Object
29 30 31 |
# File 'lib/decouplio/action_state_printer.rb', line 29 def self.action_context(action) action.ctx.map { |k, v| "#{k.inspect} => #{v.inspect}" }.join("\n ") end |
.call(action) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/decouplio/action_state_printer.rb', line 5 def self.call(action) <<~INSPECT Result: #{result(action)} RailwayFlow: #{railway_flow(action)} Context: #{action_context(action)} #{(action)} INSPECT end |
.meta_store(action) ⇒ Object
33 34 35 |
# File 'lib/decouplio/action_state_printer.rb', line 33 def self.(action) action.ms.to_s end |
.railway_flow(action) ⇒ Object
25 26 27 |
# File 'lib/decouplio/action_state_printer.rb', line 25 def self.railway_flow(action) action.railway_flow.join(' -> ') end |
.result(action) ⇒ Object
21 22 23 |
# File 'lib/decouplio/action_state_printer.rb', line 21 def self.result(action) action.success? ? 'success' : 'failure' end |