cuprum 0.7.0.rc.0 → 0.7.0.rc.1

This diff has not been reviewed by any users.
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
  SHA1:
3
- metadata.gz: 42f7f2e7dafb202aa6ccef0b4f11972a70ba1206
4
- data.tar.gz: 920ad2c0c2ef8916faf1696d0c17abb040d5e8b4
3
+ metadata.gz: 8e0ca5271959fafe43676c1ba02d71d3f5e32aaa
4
+ data.tar.gz: 63d16aac59bdb484d16c2c828eaabf5c962e70f6
5
5
  SHA512:
6
- metadata.gz: 68ce14ebada98c8a1fb6e0b3f3fc0e0c8cadbc3e487b6661c82f144927c1aef2a8dd8e392217e419f25b47db1f133a1eda2b0440a75004390066a509e5cd40c3
7
- data.tar.gz: 4238932688704262a554d90483bb3642ee3d84c13b31a7db35e64d6a1a8496db4abb0b95bbdd5c1b84df50d5893579500fb1673268226140d9774795327e1a13
6
+ metadata.gz: ae506bda9686706cfb1732187b02bfa5c665570b4eaf5c5a00f59fee25cd2879ca266d4a789767ad41875a9a06f422cf9c780b5275efe1742a6c3f382a01997d
7
+ data.tar.gz: 2c2f9c39c30efebb7d31fa8f24b668b424ea0b279e8312f59c2be04ca84d7b940369db2a3fc49f284e0a97f19bd175e531167fa6fb6d3d0d263438146338948a
@@ -18,6 +18,8 @@ Implemented the `#arity` method, which returns an indication of the number of ar
18
18
 
19
19
  Refactored internal logic for returning result objects.
20
20
 
21
+ Fixed a bug causing an erroneous warning to be displayed when `#process` discards an old result with a value.
22
+
21
23
  ## 0.6.0
22
24
 
23
25
  The "By Your Command" Update.
@@ -15,6 +15,7 @@
15
15
  - Command#to_proc
16
16
  - :clear_errors => true option on #chain
17
17
  - #context object
18
+ - command currying
18
19
 
19
20
  #### Cuprum::DSL
20
21
 
@@ -128,9 +128,7 @@ module Cuprum
128
128
  if value_is_result?(other)
129
129
  return result if result == other
130
130
 
131
- if result.respond_to?(:empty?) && !result.empty?
132
- Cuprum.warn(Cuprum::Utils::ResultNotEmptyWarning.new(result).message)
133
- end # if
131
+ warn_unless_empty!(result)
134
132
 
135
133
  other.to_result
136
134
  else
@@ -176,5 +174,13 @@ module Cuprum
176
174
  def value_is_result? value
177
175
  VALUE_METHODS.all? { |method_name| value.respond_to?(method_name) }
178
176
  end # method value
177
+
178
+ def warn_unless_empty! result
179
+ return unless result.respond_to?(:empty?) && !result.empty?
180
+
181
+ not_empty = Cuprum::Utils::ResultNotEmptyWarning.new(result)
182
+
183
+ Cuprum.warn(not_empty.message) if not_empty.warning?
184
+ end # method warn_unless_empty!
179
185
  end # module
180
186
  end # module
@@ -16,10 +16,16 @@ module Cuprum::Utils
16
16
 
17
17
  # @return [String] The warning message for the given result.
18
18
  def message
19
- # byebug
19
+ return ''.freeze if warnings.empty?
20
+
20
21
  MESSAGE + humanize_list(warnings).freeze
21
22
  end # method message
22
23
 
24
+ # @return [Boolean] True if a warning is generated, otherwise false.
25
+ def warning?
26
+ !warnings.empty?
27
+ end # method warning?
28
+
23
29
  private
24
30
 
25
31
  attr_reader :result
@@ -55,11 +61,12 @@ module Cuprum::Utils
55
61
  end # method status_set_warning
56
62
 
57
63
  def warnings
58
- [
59
- errors_not_empty_warning,
60
- status_set_warning,
61
- halted_warning
62
- ].compact
64
+ @warnings ||=
65
+ [
66
+ errors_not_empty_warning,
67
+ status_set_warning,
68
+ halted_warning
69
+ ].compact
63
70
  end # method warnings
64
71
  end # class
65
72
  end # module
@@ -14,7 +14,7 @@ module Cuprum
14
14
  # Prerelease version.
15
15
  PRERELEASE = :rc
16
16
  # Build metadata.
17
- BUILD = 0
17
+ BUILD = 1
18
18
 
19
19
  class << self
20
20
  # 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: 0.7.0.rc.0
4
+ version: 0.7.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: 2018-03-08 00:00:00.000000000 Z
11
+ date: 2018-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec