excom 0.1.1 → 0.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
  SHA1:
3
- metadata.gz: f3ce8ddb0d9f3eb163e404bb331a5b188e4b7231
4
- data.tar.gz: 7e0b3a4cbb11420002803618328faa4f39e651ee
3
+ metadata.gz: 7f560f7894a0530703e6a5ecb6f472e61b4ae37b
4
+ data.tar.gz: 764f807e1ccbb3f3daf38dfda5cca89b42a7b22c
5
5
  SHA512:
6
- metadata.gz: e47af5a9296b59a8bf194c9fb081f592c73df2056c7ba00e79e0e40b4cafd79daf6e00b2ad63160514e881cfceecfb7a37fca3e6c0525d572fdf6c08c1759522
7
- data.tar.gz: 7ba40674e28405799fe22b33308190328073b56268db1bd0a5ff6dd7bc570da84cf4c452f03b6626d444fce64083b9fe5c5bcb05a01f42167c78e17847d6a15d
6
+ metadata.gz: bf2e04d3f7f91341768d54ce4033041ba3787529e45390beaf4035e2d72bfed4c5454e6fecab3c00cc6ff9f583cc8da0b19863a970a0ad941467ef464cc42670
7
+ data.tar.gz: 06d5a6496d1a653ac920b51f9712af6a4321235a41624c18931c46170936b953a847ad3e014660df6356f89368ffd2dd470269478d59a6386cf35d20b4d47b27
@@ -5,6 +5,8 @@ module Excom
5
5
  UNDEFINED = :__EXCOM_UNDEFINED__
6
6
  private_constant :UNDEFINED
7
7
 
8
+ Result = Struct.new(:status, :result)
9
+
8
10
  def initialize(*)
9
11
  @executed = false
10
12
  super
@@ -27,6 +29,10 @@ module Excom
27
29
  @executed
28
30
  end
29
31
 
32
+ def ~@
33
+ Result.new(status, result)
34
+ end
35
+
30
36
  private def run
31
37
  success!
32
38
  end
@@ -53,6 +59,11 @@ module Excom
53
59
  end
54
60
 
55
61
  private def result_with(obj)
62
+ if Result === obj
63
+ @status, @result = obj.status, obj.result
64
+ return @result
65
+ end
66
+
56
67
  @status = obj ? :success : fail_with unless defined?(@status)
57
68
  @result = obj
58
69
  end
data/lib/excom/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Excom
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Kuzko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-11 00:00:00.000000000 Z
11
+ date: 2018-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler