Class: Trailblazer::Activity::End

Inherits:
Object
  • Object
show all
Defined in:
lib/trailblazer/activity/structures.rb

Overview

Any instance of subclass of End will halt the circuit’s execution when hit. An End event is a simple structure typically found as the last task invoked in an activity. The special behavior is that it a) maintains a semantic that is used to further connect that very event b) its ‘End#call` method returns the end instance itself as the signal.

Direct Known Subclasses

Start

Instance Method Summary collapse

Constructor Details

#initialize(semantic:, **options) ⇒ End

Returns a new instance of End.



11
12
13
# File 'lib/trailblazer/activity/structures.rb', line 11

def initialize(semantic:, **options)
  @options = options.merge(semantic: semantic)
end

Instance Method Details

#call(args) ⇒ Object



15
16
17
# File 'lib/trailblazer/activity/structures.rb', line 15

def call(args, **)
  return self, args
end

#to_hObject



19
20
21
# File 'lib/trailblazer/activity/structures.rb', line 19

def to_h
  @options
end

#to_sObject Also known as: inspect



23
24
25
# File 'lib/trailblazer/activity/structures.rb', line 23

def to_s
  %(#<#{self.class.name} #{@options.collect { |k, v| "#{k}=#{v.inspect}" }.join(" ")}>)
end