tron 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/tron.rb +17 -15
  3. data/lib/tron/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dfcccbabeb21e2c523a53b47c542619f8fc8ed0f9c36a6b0cff55ae9d378d100
4
- data.tar.gz: 762450996467cfc68b446fe484bafcd1ede73375cfadb541db256cef7f168aa6
3
+ metadata.gz: 0231e5a13e707acc3ec83ffc50af2cb846b01c31ba8e2bb9fc105e78d30bd60e
4
+ data.tar.gz: b3ab4cd46c20a71bfc2673345f5da04ca0a388e2141c259387976952ddd7c983
5
5
  SHA512:
6
- metadata.gz: a391636868501ea17ed7b8c06075c3b288904e1a379951e811ced590231e4315ccdd9855458599f7a76f1e5ea85324e987506a04bcc8bd5c5f82bb9cbc0278d2
7
- data.tar.gz: 4f0ddd7c1c53156ebaa5f25616e0a32a51ceabb42b4de6f2de34c71e693222068065bfce477a6ae208c575a1b89724e35e02c53cccd2034584220702b4ffb8a5
6
+ metadata.gz: 187817f794d517f5c176f2c719344485df1afaca69cd32caf4e94b271f38a6a80e9dd0f328e2368bc0762985e7acf711b1f77c47fb77621e77e65080101a084f
7
+ data.tar.gz: 80811f5605325a75668bdbe9e8de95f18eb481ccd094e2f4b10f6a772b4fb483c876d34c06906b42e89ad8fafffea375d1620d4a0d111e4a1d40f067f34eed04
@@ -2,24 +2,24 @@
2
2
 
3
3
  require 'tron/version'
4
4
 
5
- require 'tron/resultable' # Legady
5
+ require 'tron/resultable' # Legacy
6
6
  require 'tron/success' # Legacy
7
7
  require 'tron/failure' # Legacy
8
8
 
9
9
  module Tron
10
- def self.success(code, attributes = {}) # rubocop:disable Metrics/MethodLength
10
+ def self.success(code, attributes = {}) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
11
11
  code.respond_to?(:to_sym) ||
12
12
  raise(ArgumentError, 'Tron.success must be called with a Symbol as first argument')
13
13
 
14
14
  attributes.respond_to?(:keys) ||
15
- raise(ArgumentError, 'The attributes Hash for Tron.success must respond to #keys')
15
+ raise(ArgumentError, 'The second argument (metadata) for Tron.success must respond to #keys')
16
16
 
17
17
  attributes.respond_to?(:values) ||
18
- raise(ArgumentError, 'The attributes Hash for Tron.success must respond to #values')
18
+ raise(ArgumentError, 'The second argument (metadata) for Tron.success must respond to #values')
19
19
 
20
20
  Struct.new(:success, *attributes.keys) do
21
- undef_method '[]='.to_sym
22
- members.each { |member| undef_method "#{member}=".to_sym }
21
+ undef_method :[]=
22
+ members.each { |member| undef_method :"#{member}=" }
23
23
 
24
24
  def success?
25
25
  true
@@ -34,7 +34,8 @@ module Tron
34
34
  end
35
35
 
36
36
  def code
37
- warn "DEPRECATION WARNING: Calling `#code` on a Tron object is deprecated and will be removed in Tron 2.0.0. Please use `#success` instead. Called from `#{caller.first}`"
37
+ warn 'DEPRECATION WARNING: Calling `#code` on a Tron object is deprecated and will be removed in Tron 2.0.0. ' \
38
+ "Please use `#success` instead. Called from `#{caller.first}`"
38
39
 
39
40
  success
40
41
  end
@@ -46,22 +47,22 @@ module Tron
46
47
  def on_failure(_ = nil)
47
48
  self
48
49
  end
49
- end.new code.to_sym, *attributes.values.map(&:freeze)
50
+ end.new code.to_sym, *attributes.values
50
51
  end
51
52
 
52
- def self.failure(code, attributes = {}) # rubocop:disable Metrics/MethodLength
53
+ def self.failure(code, attributes = {}) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
53
54
  code.respond_to?(:to_sym) ||
54
55
  raise(ArgumentError, 'Tron.failure must be called with a Symbol as first argument')
55
56
 
56
57
  attributes.respond_to?(:keys) ||
57
- raise(ArgumentError, 'The attributes Hash for Tron.failure must respond to #keys')
58
+ raise(ArgumentError, 'The second argument (metadata) for Tron.failure must respond to #keys')
58
59
 
59
60
  attributes.respond_to?(:values) ||
60
- raise(ArgumentError, 'The attributes Hash for Tron.failure must respond to #values')
61
+ raise(ArgumentError, 'The second argument (metadata) for Tron.failure must respond to #values')
61
62
 
62
63
  Struct.new(:failure, *attributes.keys) do
63
- undef_method '[]='.to_sym
64
- members.each { |member| undef_method "#{member}=".to_sym }
64
+ undef_method :[]=
65
+ members.each { |member| undef_method :"#{member}=" }
65
66
 
66
67
  def success?
67
68
  false
@@ -76,7 +77,8 @@ module Tron
76
77
  end
77
78
 
78
79
  def code
79
- warn "DEPRECATION WARNING: Calling `#code` on a Tron object is deprecated and will be removed in Tron 2.0.0. Please use `#failure` instead. Called from `#{caller.first}`"
80
+ warn 'DEPRECATION WARNING: Calling `#code` on a Tron object is deprecated and will be removed in Tron 2.0.0. ' \
81
+ "Please use `#failure` instead. Called from `#{caller.first}`"
80
82
 
81
83
  failure
82
84
  end
@@ -88,6 +90,6 @@ module Tron
88
90
  def on_failure(proc = nil, &block)
89
91
  (proc || block).call self
90
92
  end
91
- end.new code.to_sym, *attributes.values.map(&:freeze)
93
+ end.new code.to_sym, *attributes.values
92
94
  end
93
95
  end
@@ -1,7 +1,7 @@
1
1
  module Tron
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 1
4
- MINOR = 1
4
+ MINOR = 2
5
5
  TINY = 0
6
6
  PRE = nil
7
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tron
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - halo