lite-command 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ecfaebe941a3ed585e42a5a43b361d60de38076b6a4254125722b13d57294885
4
- data.tar.gz: da15660c9410a9c8797d6c322ab79797f800f5233319a7a39d6476bba10504ec
3
+ metadata.gz: e36dd86e0746fcaaa37f79e73a94b0ae406e1989c02105c6378c5f1ea8694165
4
+ data.tar.gz: a10c6bda6ce19982ef9b983faa7ffa7ad3063ae8fc627229dc725238475c86c3
5
5
  SHA512:
6
- metadata.gz: b91f356964b41577a7e274a5cc5cf46c74b60a088ffa781e7c5f3cbf0f7bd7713accf16ddf8bee16e99342e04a0040ea8dab2fb8c5ff7eb3132d7e3000596ca0
7
- data.tar.gz: d905466a1fe16049f5af3877c2488120eb581070fe85a9bf20654cf09127bcccc8e6e9a79c436f16164e3104d5fc7d1bd6bbb7b839069250d29cc4b551e8c47e
6
+ metadata.gz: f71e320cd7ec5b4c105900fd984c6f73fa30323ef734cf03b8b6333eebed459ac9c54234433864ce20b719ffa80eff6b3da9f4021257b965c7bc8380a3310518
7
+ data.tar.gz: 78563217138c0d55133d344e914a9edb59cf9e59aaece25af3d1486657741151737d21f33a054821b80f26e3fd6bc92934e27bc3b9b3287cce969017284fa495
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [3.2.1] - 2024-10-29
10
+ ### Changed
11
+ - Allow if and unless evaluations to happen at the same time
12
+
9
13
  ## [3.2.0] - 2024-10-29
10
14
  ### Changed
11
15
  - Move callbacks to hooks instead of try methods
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-command (3.2.0)
4
+ lite-command (3.2.1)
5
5
  activemodel
6
6
  ostruct
7
7
 
data/README.md CHANGED
@@ -289,10 +289,10 @@ cmd.context.decrypted_message #=> "Hola Mundo"
289
289
  # With invalid options:
290
290
  cmd = DecryptSecretMessage.call(encrypted_message: "idk", version: "v23")
291
291
  cmd.status #=> "invalid"
292
- cmd.reason #=> "Encrypted message is too short (minimum is 10 character). Version is not included in list..."
292
+ cmd.reason #=> "Encrypted message is too short (minimum is 10 character). Encrypted message has invalid magic numbers. Version is not included in list."
293
293
  cmd.metadata #=> {
294
294
  #=> user: ["is not included in list"],
295
- #=> encrypted_message: ["is too short (minimum is 10 character)"]
295
+ #=> encrypted_message: ["is too short (minimum is 10 character)", "has invalid magic numbers"]
296
296
  #=> }
297
297
  ```
298
298
 
@@ -388,28 +388,18 @@ cmd.bad?("Other reason") #=> false
388
388
 
389
389
  Use hooks to run arbituary code at transition points and on finalized internals.
390
390
  All hooks are ran in the order they are defined. Hooks types can be defined
391
- multiple times. The following is an example of the hooks called for a failed
392
- command with a successful child command.
391
+ multiple times. Hooks are ran in the following order:
393
392
 
394
393
  ```ruby
395
- -> 1. FooCommand.after_initialize
396
- -> 2. FooCommand.on_pending
397
- -> 3. FooCommand.before_validation
398
- -> 4. FooCommand.after_validation
399
- -> 5. FooCommand.before_execution
400
- -> 6. FooCommand.on_executing
401
- ---> 6a. BarCommand.after_initialize
402
- ---> 6b. BarCommand.on_pending
403
- ---> 6c. BarCommand.before_validation
404
- ---> 6d. BarCommand.after_validation
405
- ---> 6e. BarCommand.before_execution
406
- ---> 6f. BarCommand.on_executing
407
- ---> 6g. BarCommand.after_execution
408
- ---> 6h. BarCommand.on_failure
409
- ---> 6i. BarCommand.on_interrupted
410
- -> 7. FooCommand.after_execution
411
- -> 8. FooCommand.on_failure
412
- -> 9. FooCommand.on_interrupted
394
+ 1. after_initialize
395
+ 2. on_pending
396
+ 3. before_validation
397
+ 4. after_validation
398
+ 5. before_execution
399
+ 6. on_executing
400
+ 7. after_execution
401
+ 8. on_[success, noop, invalid, failure, error]
402
+ 9. on_[complete, interrupted]
413
403
  ```
414
404
 
415
405
  ### Lifecycle Hooks
@@ -40,7 +40,9 @@ module Lite
40
40
  end
41
41
 
42
42
  def evaluate(object, options = {})
43
- if options[:if]
43
+ if options[:if] && options[:unless]
44
+ call(object, options[:if]) && !call(object, options[:unless])
45
+ elsif options[:if]
44
46
  call(object, options[:if])
45
47
  elsif options[:unless]
46
48
  !call(object, options[:unless])
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Command
5
5
 
6
- VERSION = "3.2.0"
6
+ VERSION = "3.2.1"
7
7
 
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lite-command
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez