cuprum 1.0.0.rc.0 → 1.0.0.rc.1

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: d42abc97f91b8693f2ecd931857ad6818a1d818f6eaad1f3f9999bf948751d7d
4
- data.tar.gz: 240587d60e6d7607e4a5bf89819014482847705d6f6c70f941172e58790de11c
3
+ metadata.gz: 1acf1f03e1b78fd7c90cb8b3eb96bd2ba8771b29dd92c743a7580c22700919df
4
+ data.tar.gz: 07eae29a24b5819cf80c646c016fb7e0508ffe93f5820795a74d1c2dfdbd6bf4
5
5
  SHA512:
6
- metadata.gz: '077659f1208f14487834e90aafa19fc828e31d73533012b9eda8751905cc1383298d89674a9ff86e0e6f248013db1610692f08f2ff83b7ba3b2a47f22d847752'
7
- data.tar.gz: 71fbc512da8fb324bb3372bde996bd3fb810fc7aa7b758b59747405da815d66dc16edc90850a390ab65bfc5a67fc195b33217163589d3cc51e0d30ca67c3d9c1
6
+ metadata.gz: cec2ebc229e0507dde9ca02aedf2bd93f55161151eef230f43408d4e39d7ab8b8711c655c72d4b193733f9a2b235e95cb390c57cccebb61f6e129915b261588c
7
+ data.tar.gz: d10c6180899006af62022ac1f9543897d258f8407a3dfca56d270f0eba356a7aabd418234330901dd3b8e3c55de27f07e9ae4c2c37398056800331bd8b6ae8f1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.0
4
+
5
+ The "Look On My Works, Ye Mighty, and Despair" Update
6
+
7
+ #### Steps
8
+
9
+ Removed calling `#step` with a method name.
10
+
3
11
  ## 0.11.0
4
12
 
5
13
  The "One Giant Leap" Update
data/DEVELOPMENT.md CHANGED
@@ -1,24 +1,5 @@
1
1
  # Development
2
2
 
3
- ## Version 1.0.0
4
-
5
- The "Look On My Works, Ye Mighty, and Despair" Update
6
-
7
- - Documentation pass.
8
-
9
- Steps Case Study: |
10
-
11
- CMS application - creating a new post.
12
- Directory has many Posts
13
- Post has a Content
14
- Post has many Tags
15
-
16
- Find Directory
17
- Create Post
18
- Create Content
19
- Tags.each { FindOrCreate Tag }
20
- Publish Post # Requires that post have content
21
-
22
3
  ## Future Versions
23
4
 
24
5
  Add `.rbs` files
data/lib/cuprum/steps.rb CHANGED
@@ -63,56 +63,6 @@ module Cuprum
63
63
  module Steps
64
64
  include Cuprum::ResultHelpers
65
65
 
66
- UNDEFINED = Object.new.freeze
67
- private_constant :UNDEFINED
68
-
69
- class << self
70
- # @!visibility private
71
- def execute_method(receiver, method_name, *args, **kwargs, &block)
72
- if block_given? && kwargs.empty?
73
- receiver.send(method_name, *args, &block)
74
- elsif block_given?
75
- receiver.send(method_name, *args, **kwargs, &block)
76
- elsif kwargs.empty?
77
- receiver.send(method_name, *args)
78
- else
79
- receiver.send(method_name, *args, **kwargs)
80
- end
81
- end
82
-
83
- # @!visibility private
84
- def extract_result_value(result)
85
- return result unless result.respond_to?(:to_cuprum_result)
86
-
87
- result = result.to_cuprum_result
88
-
89
- return result.value if result.success?
90
-
91
- throw :cuprum_failed_step, result
92
- end
93
-
94
- # rubocop:disable Metrics/MethodLength
95
- # @!visibility private
96
- def validate_method_name(method_name)
97
- if method_name.nil?
98
- raise ArgumentError,
99
- 'expected a block or a method name',
100
- caller(1..-1)
101
- end
102
-
103
- unless method_name.is_a?(String) || method_name.is_a?(Symbol)
104
- raise ArgumentError,
105
- 'expected method name to be a String or Symbol',
106
- caller(1..-1)
107
- end
108
-
109
- return unless method_name.empty?
110
-
111
- raise ArgumentError, "method name can't be blank", caller(1..-1)
112
- end
113
- # rubocop:enable Metrics/MethodLength
114
- end
115
-
116
66
  # Executes the block and returns the value, or halts on a failure.
117
67
  #
118
68
  # @yield Called with no parameters.
@@ -155,25 +105,18 @@ module Cuprum
155
105
  # @example Calling a Step with a Failing Result
156
106
  # # The #do_something_wrong method returns a failing Cuprum result.
157
107
  # step { do_something_wrong() } # Throws the :cuprum_failed_step symbol.
158
- def step(method_name = UNDEFINED, *args, **kwargs, &block) # rubocop:disable Metrics/MethodLength
159
- result =
160
- if method_name != UNDEFINED || !args.empty? || !kwargs.empty?
161
- SleepingKingStudios::Tools::CoreTools.deprecate(
162
- "#{self.class}#step(method_name)",
163
- message: 'Use the block form: step { method_name(*args, **kwargs) }'
164
- )
108
+ def step
109
+ raise ArgumentError, 'expected a block' unless block_given?
110
+
111
+ result = yield
112
+
113
+ return result unless result.respond_to?(:to_cuprum_result)
165
114
 
166
- Cuprum::Steps.validate_method_name(method_name)
115
+ result = result.to_cuprum_result
167
116
 
168
- Cuprum::Steps
169
- .execute_method(self, method_name, *args, **kwargs, &block)
170
- elsif !block_given?
171
- raise ArgumentError, 'expected a block'
172
- else
173
- block.call
174
- end
117
+ return result.value if result.success?
175
118
 
176
- Cuprum::Steps.extract_result_value(result)
119
+ throw :cuprum_failed_step, result
177
120
  end
178
121
 
179
122
  # Returns the first failing #step result, or the final result if none fail.
@@ -16,7 +16,7 @@ module Cuprum
16
16
  # Prerelease version.
17
17
  PRERELEASE = :rc
18
18
  # Build metadata.
19
- BUILD = 0
19
+ BUILD = 1
20
20
 
21
21
  class << self
22
22
  # Generates the gem version string from the Version constants.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuprum
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc.0
4
+ version: 1.0.0.rc.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob "Merlin" Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-20 00:00:00.000000000 Z
11
+ date: 2021-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sleeping_king_studios-tools