trailblazer-activity 0.4.1 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b2666e0f5190759b775c83c2cd4d04c87d64b230e71e4921a01c6656fd27d5c8
4
- data.tar.gz: b16fe2deab89048538e6351aabd5b274a55f378e0dc081ea3e3519586a2146be
3
+ metadata.gz: bed08027bb74c9466a7dee0325bf2eb5fddc637eb2e46f3f86a3292e522fe083
4
+ data.tar.gz: 3a89ef72fbbb55f084779cb376f68ef542486d4a5b0fe8af1200e594fea6f6b4
5
5
  SHA512:
6
- metadata.gz: 3c100c03b31cd3abf3d8c60b16d6e710202c9503e74aadd2f70d8c41ae33a48fcc92b86e862e58c0609fdcb9169ab1dcd3e4a08aa933a78412b397dccbd49591
7
- data.tar.gz: 73a7aa9fec238f54c07b888038e252948fa3c4db76183b37f6848421c53e3c2a31aab4bb235889517edc8ec4d3b055d1855c475811a4bf692d9653776d9979f1
6
+ metadata.gz: 1c221eba23024d176d6c6c3376fd3aa6c5a668806d3b2cccd09e7a85496a07c833dddb74fa30e6c346eb0e8093b8186f1f8cc1557a21a37f1feddb7a9fabd7a9
7
+ data.tar.gz: 27e679eab5c94988e821e05a7bdb25c301e656091f8bc100bb84a142cec3ec0f7fced3c61bb7ef0d5b2e89cd0847d22e7db2ca17c783906316628216dad93e12
data/CHANGES.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.4.2
2
+
3
+ * `End` is not a `Struct` so we can maintain more state, and are immutable.
4
+
1
5
  # 0.4.1
2
6
 
3
7
  * Remove `decompose` and replace it with a better `to_h`.
@@ -33,7 +33,7 @@ module Trailblazer
33
33
  builder_options={ track_color: track_color, end_semantic: end_semantic }
34
34
 
35
35
  start_adds = adds(
36
- Activity::Start.new(:default),
36
+ Activity::Start.new(semantic: :default),
37
37
 
38
38
  TaskPolarizations(builder_options),
39
39
 
@@ -1,5 +1,9 @@
1
1
  module Trailblazer
2
2
  class Activity < Module # End event is just another callable task.
3
+ # Builds an Activity::End instance.
4
+ def self.End(semantic)
5
+ End.new(semantic: semantic)
6
+ end
3
7
 
4
8
  # Any instance of subclass of End will halt the circuit's execution when hit.
5
9
 
@@ -7,10 +11,25 @@
7
11
  # in an activity. The special behavior is that it
8
12
  # a) maintains a semantic that is used to further connect that very event
9
13
  # b) its `End#call` method returns the end instance itself as the signal.
10
- End = Struct.new(:semantic) do
14
+ class End
15
+ def initialize(semantic:, **options)
16
+ @options = options.merge(semantic: semantic)
17
+ end
18
+
11
19
  def call(*args)
12
20
  return self, *args
13
21
  end
22
+
23
+ def to_h
24
+ @options
25
+ end
26
+
27
+ def inspect
28
+ to_s
29
+ end
30
+ def to_s
31
+ %{#<#{self.class.name} #{@options.collect{ |k,v| "#{k}=#{v.inspect}" }.join(" ")}>}
32
+ end
14
33
  end
15
34
 
16
35
  class Start < End
@@ -19,11 +38,6 @@
19
38
  end
20
39
  end
21
40
 
22
- # Builds an Activity::End instance.
23
- def self.End(semantic)
24
- Activity::End.new(semantic)
25
- end
26
-
27
41
  class Signal; end
28
42
  class Right < Signal; end
29
43
  class Left < Signal; end
@@ -1,5 +1,5 @@
1
1
  module Trailblazer
2
2
  class Activity < Module
3
- VERSION = "0.4.1"
3
+ VERSION = "0.4.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trailblazer-activity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer