foobara 0.0.68 → 0.0.70
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 +4 -4
- data/CHANGELOG.md +8 -0
- data/projects/command/src/command_pattern_implementation/concerns/subcommands.rb +9 -1
- data/projects/state_machine/src/callbacks.rb +2 -4
- data/projects/state_machine/src/state_machine.rb +27 -3
- data/projects/state_machine/src/transition_log.rb +1 -1
- data/projects/type_declarations/lib/foobara/type_declarations.rb +0 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fa42ccdb3430fea47bc5de7590f08ef9c640e87d747eec8d4a594d4fd8d8a91
|
4
|
+
data.tar.gz: 797a5cef37a8478295bc5c887766ec69819fa150c005bd49e7501d3609337ff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 771d25f93db9d12e31a9f74143840375bf1cd702f7b02f394c44411c12f50d37ce210213737794778dca08e6264ac4166b094930edb6969f20117f2b888d7e49
|
7
|
+
data.tar.gz: c565ae11e35f1a767761823655e2294a70cd07fa02acb403bb6f37d43a3f471bb909d4b315e7defaaadb56b999e9778466092238f2f89af3722aa169666eee11
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
# [0.0.70] - 2025-03-06
|
2
|
+
|
3
|
+
- Make sure Foobara::Command.depends_on is inherited
|
4
|
+
|
5
|
+
## [0.0.69] - 2025-03-03
|
6
|
+
|
7
|
+
- Allow StateMachine to use an attribute on another object as its current state for convenience
|
8
|
+
|
1
9
|
## [0.0.68] - 2025-02-28
|
2
10
|
|
3
11
|
- Make use of LruCache for performance boost when converting type declarations to types
|
@@ -56,7 +56,15 @@ module Foobara
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def depends_on(*subcommand_classes)
|
59
|
-
|
59
|
+
if subcommand_classes.empty?
|
60
|
+
return @depends_on if defined?(@depends_on)
|
61
|
+
|
62
|
+
@depends_on = if self == Foobara::Command
|
63
|
+
Set.new
|
64
|
+
else
|
65
|
+
superclass.depends_on.dup
|
66
|
+
end
|
67
|
+
end
|
60
68
|
|
61
69
|
if subcommand_classes.length == 1
|
62
70
|
subcommand_classes = Util.array(subcommand_classes.first)
|
@@ -3,11 +3,9 @@ module Foobara
|
|
3
3
|
module Callbacks
|
4
4
|
include Concern
|
5
5
|
|
6
|
-
|
7
|
-
attr_accessor :callback_registry, :owner
|
6
|
+
attr_accessor :callback_registry
|
8
7
|
|
9
|
-
def initialize(
|
10
|
-
self.owner = owner
|
8
|
+
def initialize(...)
|
11
9
|
self.callback_registry = Callback::Registry::ChainedConditioned.new(self.class.class_callback_registry)
|
12
10
|
end
|
13
11
|
|
@@ -34,12 +34,36 @@ module Foobara
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
attr_accessor :
|
37
|
+
attr_accessor :target_attribute, :owner
|
38
|
+
|
39
|
+
# owner is optional. It can help with certain callbacks. It's also required if planning to use the target_attribute
|
40
|
+
# feature
|
41
|
+
def initialize(*args, owner: nil, target_attribute: nil, **options)
|
42
|
+
self.owner = owner
|
38
43
|
|
39
|
-
def initialize(*args, **options)
|
40
44
|
super
|
41
45
|
|
42
|
-
|
46
|
+
if target_attribute
|
47
|
+
self.target_attribute = target_attribute
|
48
|
+
else
|
49
|
+
self.current_state = self.class.initial_state
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def current_state
|
54
|
+
if target_attribute
|
55
|
+
owner.send(target_attribute) || self.class.initial_state
|
56
|
+
else
|
57
|
+
@current_state
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def current_state=(state)
|
62
|
+
if target_attribute
|
63
|
+
owner.send("#{target_attribute}=", state)
|
64
|
+
else
|
65
|
+
@current_state = state
|
66
|
+
end
|
43
67
|
end
|
44
68
|
|
45
69
|
def perform_transition!(transition, &block)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foobara
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.70
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Georgi
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-03-06 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: bigdecimal
|
@@ -460,7 +460,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
460
460
|
- !ruby/object:Gem::Version
|
461
461
|
version: '0'
|
462
462
|
requirements: []
|
463
|
-
rubygems_version: 3.6.
|
463
|
+
rubygems_version: 3.6.5
|
464
464
|
specification_version: 4
|
465
465
|
summary: A command-centric and discoverable software framework with a focus on domain
|
466
466
|
concepts and abstracting away integration code
|