Class: Plumbing::Actor::Inline
- Inherits:
-
Object
- Object
- Plumbing::Actor::Inline
- Defined in:
- lib/plumbing/actor/inline.rb
Instance Method Summary collapse
- #in_context? ⇒ Boolean
-
#initialize(target) ⇒ Inline
constructor
A new instance of Inline.
- #safely ⇒ Object
-
#send_message(message_name, *args, **params) ⇒ Object
Send the message to the target and wrap the result.
- #stop ⇒ Object
Constructor Details
#initialize(target) ⇒ Inline
Returns a new instance of Inline.
4 5 6 |
# File 'lib/plumbing/actor/inline.rb', line 4 def initialize target @target = target end |
Instance Method Details
#in_context? ⇒ Boolean
26 |
# File 'lib/plumbing/actor/inline.rb', line 26 def in_context? = true |
#safely ⇒ Object
20 21 22 23 24 |
# File 'lib/plumbing/actor/inline.rb', line 20 def safely(&) Plumbing.config.logger.debug { "-> #{@target.class}#perform_safely" } (:perform_safely, &) nil end |
#send_message(message_name, *args, **params) ⇒ Object
Send the message to the target and wrap the result
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/plumbing/actor/inline.rb', line 9 def (, *args, **params, &) Plumbing.config.logger.debug { "-> #{@target.class}##{}(#{args.inspect}, #{params.inspect})" } Plumbing.config.logger.debug { "---> #{@target.class}##{}(#{args.inspect}, #{params.inspect})" } value = @target.send(, *args, **params, &) Plumbing.config.logger.debug { "===> #{@target.class}##{} => #{value}" } Result.new(value) rescue => ex Plumbing.config.logger.debug { "!!!! #{@target.class}##{} => #{ex}" } Result.new(ex) end |
#stop ⇒ Object
28 |
# File 'lib/plumbing/actor/inline.rb', line 28 def stop = nil |