mu-result 1.2.0 → 2.2.0

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: 7035a2ec94da66780f5ad89cc4cc1975a16633e2021b7bbc0366007ae5100773
4
- data.tar.gz: 10c5f2b8f40fdfebe315663551f954b16049ad84a6327fa78e3e29ac44f84fe0
3
+ metadata.gz: 989d4a89a0fe3f52451e1668248ea8c251094be664bebbb47720085eb037fe5c
4
+ data.tar.gz: 25426faf51178ecc7ec8e79e8cff7a6abbd507ac1b673f0ebd46820bcdae1c07
5
5
  SHA512:
6
- metadata.gz: 8d4fbb1d0c9d670d2ae6073d293780de9ec232035732720779b205771f43239a0a3394673aa9f4317155ff6ec5eee8dc0f8fb142a8399363213b00da1b7ed4ee
7
- data.tar.gz: 1ecc708bdd34a381a034613ae6d85def2a846e2542e136b5de1542205fa55538dee83387ca4796400e6819eaf512875ba734079c50c3b70c42d0968888a8373b
6
+ metadata.gz: 60a1a45f47b5887505d88658608d8cee731c364f17526df20e46850dbd11def90061b7737d7d1c1859da52911be2181c0b375de9ae4908f5d25e169dc06afe98
7
+ data.tar.gz: 5e643c2505a8ddc44732b6742e64b96dbe626258d9e42f8f1bb85994213804420026e5541c0a5faed2b0be7345e1e3d2c031ad377f8067db26399d44ce91c78b
data/Gemfile.lock CHANGED
@@ -1,35 +1,35 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mu-result (1.2.0)
4
+ mu-result (2.1.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- diff-lcs (1.3)
10
- rake (10.5.0)
11
- rspec (3.8.0)
12
- rspec-core (~> 3.8.0)
13
- rspec-expectations (~> 3.8.0)
14
- rspec-mocks (~> 3.8.0)
15
- rspec-core (3.8.0)
16
- rspec-support (~> 3.8.0)
17
- rspec-expectations (3.8.2)
9
+ diff-lcs (1.4.4)
10
+ rake (13.0.3)
11
+ rspec (3.10.0)
12
+ rspec-core (~> 3.10.0)
13
+ rspec-expectations (~> 3.10.0)
14
+ rspec-mocks (~> 3.10.0)
15
+ rspec-core (3.10.1)
16
+ rspec-support (~> 3.10.0)
17
+ rspec-expectations (3.10.1)
18
18
  diff-lcs (>= 1.2.0, < 2.0)
19
- rspec-support (~> 3.8.0)
20
- rspec-mocks (3.8.0)
19
+ rspec-support (~> 3.10.0)
20
+ rspec-mocks (3.10.2)
21
21
  diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.8.0)
23
- rspec-support (3.8.0)
22
+ rspec-support (~> 3.10.0)
23
+ rspec-support (3.10.2)
24
24
 
25
25
  PLATFORMS
26
26
  ruby
27
27
 
28
28
  DEPENDENCIES
29
- bundler (~> 1.16)
29
+ bundler (~> 2.2)
30
30
  mu-result!
31
- rake (~> 10.0)
31
+ rake (~> 13.0)
32
32
  rspec (~> 3.0)
33
33
 
34
34
  BUNDLED WITH
35
- 1.17.3
35
+ 2.2.15
@@ -2,7 +2,8 @@ module Mu
2
2
  module Result
3
3
 
4
4
  class BaseResult
5
- def initialize(code: :ok, data: nil)
5
+ def initialize(is_success: true, code: :ok, data: nil)
6
+ @is_success = is_success
6
7
  @code = code
7
8
  @data = data
8
9
  end
@@ -21,7 +22,7 @@ module Mu
21
22
  end
22
23
 
23
24
  def success?
24
- @code == :ok
25
+ @is_success == true
25
26
  end
26
27
 
27
28
  def error?
@@ -32,12 +33,22 @@ module Mu
32
33
  return data if symbol.nil?
33
34
 
34
35
  if !data.respond_to?(:include?) || !data.include?(symbol)
35
- raise StandardError.new("The symbol '#{symbol}' is not included in the result data object.")
36
+ messages = []
37
+ messages << "The symbol '#{symbol}' is not included in the result data object."
38
+ messages += caller
39
+ raise StandardError.new(messages.join("\n"))
36
40
  end
37
41
 
38
42
  return data[symbol]
39
43
  end
44
+
45
+ def to_hash
46
+ {
47
+ code: code,
48
+ data: data,
49
+ }
50
+ end
40
51
  end
41
52
 
42
53
  end
43
- end
54
+ end
@@ -1,5 +1,5 @@
1
1
  module Mu
2
2
  module Result
3
- VERSION = '1.2.0'
3
+ VERSION = '2.2.0'
4
4
  end
5
5
  end
data/lib/mu/result.rb CHANGED
@@ -5,11 +5,11 @@ module Mu
5
5
  module Result
6
6
 
7
7
  def self.success(data = nil)
8
- BaseResult.new(code: :ok, data: data)
8
+ BaseResult.new(is_success: true, code: :ok, data: data)
9
9
  end
10
10
 
11
11
  def self.error(data = nil)
12
- BaseResult.new(code: :ko, data: data)
12
+ BaseResult.new(is_success: false, code: :ko, data: data)
13
13
  end
14
14
 
15
15
  end
data/mu-result.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
 
13
13
  spec.summary = %q{μResult is a small Result object}
14
14
  spec.description = %q{μ as in micro}
15
- spec.homepage = 'https://source.olisti.co/olistik/mu-result'
15
+ spec.homepage = 'https://github.com/olistik/mu-result'
16
16
 
17
17
  # Specify which files should be added to the gem when it is released.
18
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ['lib']
25
25
 
26
- spec.add_development_dependency 'bundler', '~> 1.16'
27
- spec.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_development_dependency 'bundler', '~> 2.2'
27
+ spec.add_development_dependency 'rake', '~> 13.0'
28
28
  spec.add_development_dependency 'rspec', '~> 3.0'
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mu-result
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - olistik
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-05 00:00:00.000000000 Z
11
+ date: 2021-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '2.2'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: '2.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -74,11 +74,11 @@ files:
74
74
  - lib/mu/result/base_result.rb
75
75
  - lib/mu/result/version.rb
76
76
  - mu-result.gemspec
77
- homepage: https://source.olisti.co/olistik/mu-result
77
+ homepage: https://github.com/olistik/mu-result
78
78
  licenses:
79
79
  - AGPL-3.0
80
80
  metadata: {}
81
- post_install_message:
81
+ post_install_message:
82
82
  rdoc_options: []
83
83
  require_paths:
84
84
  - lib
@@ -93,8 +93,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  requirements: []
96
- rubygems_version: 3.0.6
97
- signing_key:
96
+ rubygems_version: 3.2.22
97
+ signing_key:
98
98
  specification_version: 4
99
99
  summary: μResult is a small Result object
100
100
  test_files: []