neo-dci 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7bf9d8483a80fef8cdd51f407ffd4e5eb19827ae
4
+ data.tar.gz: 3bbd7f67d65be8c9dcc6f8e704fe596ce8189bc3
5
+ SHA512:
6
+ metadata.gz: 4f13700c24c3b36cc81568c8905b92bc9e2b84d61b66dff78a682ac1e405d91bf928647562846729273096666d6aa84ac1c8b8ecad9fedff21db36695cc62adb
7
+ data.tar.gz: 40bb72bf60a6c5152683fe63b74bd090c88ec4602437bb72aac14c034f25402e7802192d5da400e5f83a10cf1434e6b44c26aeb042a7a5999395531ec0c7742b
@@ -17,7 +17,7 @@ module Neo
17
17
  context = new(*args)
18
18
  context.callback = result_class.new(*callbacks, &block)
19
19
  context.call
20
- raise NoCallbackCalled, callbacks unless context.callback.callback
20
+ raise NoCallbackCalled, callbacks unless context.callback.called?
21
21
  rescue NotImplementedError
22
22
  raise
23
23
  end
@@ -4,6 +4,9 @@ module Neo
4
4
  module DCI
5
5
  # Result emitted by the Context.
6
6
  class ContextResult < On
7
+ def called?
8
+ !!callback
9
+ end
7
10
  end
8
11
  end
9
12
  end
@@ -1,5 +1,5 @@
1
1
  module Neo
2
2
  module DCI
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
5
5
  end
data/neo-dci.gemspec CHANGED
@@ -15,10 +15,11 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Neo::DCI::VERSION
17
17
 
18
+ gem.add_runtime_dependency 'on', '~> 0.3.1'
19
+
18
20
  gem.add_development_dependency 'rake'
19
21
  gem.add_development_dependency 'rdoc'
20
22
  gem.add_development_dependency 'minitest'
21
23
  gem.add_development_dependency 'testem'
22
24
  gem.add_development_dependency 'simplecov'
23
- gem.add_development_dependency 'on', '~> 0.2.0'
24
25
  end
data/test/context_test.rb CHANGED
@@ -66,4 +66,37 @@ class ContextTest < NeoDCICase
66
66
  assert_equal [ :foo ], context1.callbacks
67
67
  assert_equal [ :bar ], context2.callbacks
68
68
  end
69
+
70
+ test "define own context result class" do
71
+ $success_callback_arg = nil
72
+
73
+ listener = Class.new do
74
+ def register_callbacks(result)
75
+ result.on :success do |arg|
76
+ $success_callback_arg = arg
77
+ end
78
+ end
79
+ end
80
+
81
+ context_result = Class.new(Neo::DCI::ContextResult) do
82
+ def register(listener)
83
+ listener.register_callbacks(self)
84
+ end
85
+ end
86
+
87
+ context = Class.new(TestContext) do
88
+ callbacks :success
89
+ result_class context_result
90
+
91
+ def call
92
+ callback.call :success, :ok
93
+ end
94
+ end
95
+
96
+ context.call do |my_result|
97
+ my_result.register listener.new
98
+ end
99
+
100
+ assert_equal :ok, $success_callback_arg
101
+ end
69
102
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo-dci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
5
- prerelease:
4
+ version: 0.4.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Peter Suschlik
@@ -11,104 +10,92 @@ authors:
11
10
  autorequire:
12
11
  bindir: bin
13
12
  cert_chain: []
14
- date: 2012-12-12 00:00:00.000000000 Z
13
+ date: 2014-07-21 00:00:00.000000000 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
- name: rake
16
+ name: 'on'
18
17
  requirement: !ruby/object:Gem::Requirement
19
- none: false
20
18
  requirements:
21
- - - ! '>='
19
+ - - "~>"
22
20
  - !ruby/object:Gem::Version
23
- version: '0'
24
- type: :development
21
+ version: 0.3.1
22
+ type: :runtime
25
23
  prerelease: false
26
24
  version_requirements: !ruby/object:Gem::Requirement
27
- none: false
28
25
  requirements:
29
- - - ! '>='
26
+ - - "~>"
30
27
  - !ruby/object:Gem::Version
31
- version: '0'
28
+ version: 0.3.1
32
29
  - !ruby/object:Gem::Dependency
33
- name: rdoc
30
+ name: rake
34
31
  requirement: !ruby/object:Gem::Requirement
35
- none: false
36
32
  requirements:
37
- - - ! '>='
33
+ - - ">="
38
34
  - !ruby/object:Gem::Version
39
35
  version: '0'
40
36
  type: :development
41
37
  prerelease: false
42
38
  version_requirements: !ruby/object:Gem::Requirement
43
- none: false
44
39
  requirements:
45
- - - ! '>='
40
+ - - ">="
46
41
  - !ruby/object:Gem::Version
47
42
  version: '0'
48
43
  - !ruby/object:Gem::Dependency
49
- name: minitest
44
+ name: rdoc
50
45
  requirement: !ruby/object:Gem::Requirement
51
- none: false
52
46
  requirements:
53
- - - ! '>='
47
+ - - ">="
54
48
  - !ruby/object:Gem::Version
55
49
  version: '0'
56
50
  type: :development
57
51
  prerelease: false
58
52
  version_requirements: !ruby/object:Gem::Requirement
59
- none: false
60
53
  requirements:
61
- - - ! '>='
54
+ - - ">="
62
55
  - !ruby/object:Gem::Version
63
56
  version: '0'
64
57
  - !ruby/object:Gem::Dependency
65
- name: testem
58
+ name: minitest
66
59
  requirement: !ruby/object:Gem::Requirement
67
- none: false
68
60
  requirements:
69
- - - ! '>='
61
+ - - ">="
70
62
  - !ruby/object:Gem::Version
71
63
  version: '0'
72
64
  type: :development
73
65
  prerelease: false
74
66
  version_requirements: !ruby/object:Gem::Requirement
75
- none: false
76
67
  requirements:
77
- - - ! '>='
68
+ - - ">="
78
69
  - !ruby/object:Gem::Version
79
70
  version: '0'
80
71
  - !ruby/object:Gem::Dependency
81
- name: simplecov
72
+ name: testem
82
73
  requirement: !ruby/object:Gem::Requirement
83
- none: false
84
74
  requirements:
85
- - - ! '>='
75
+ - - ">="
86
76
  - !ruby/object:Gem::Version
87
77
  version: '0'
88
78
  type: :development
89
79
  prerelease: false
90
80
  version_requirements: !ruby/object:Gem::Requirement
91
- none: false
92
81
  requirements:
93
- - - ! '>='
82
+ - - ">="
94
83
  - !ruby/object:Gem::Version
95
84
  version: '0'
96
85
  - !ruby/object:Gem::Dependency
97
- name: 'on'
86
+ name: simplecov
98
87
  requirement: !ruby/object:Gem::Requirement
99
- none: false
100
88
  requirements:
101
- - - ~>
89
+ - - ">="
102
90
  - !ruby/object:Gem::Version
103
- version: 0.2.0
91
+ version: '0'
104
92
  type: :development
105
93
  prerelease: false
106
94
  version_requirements: !ruby/object:Gem::Requirement
107
- none: false
108
95
  requirements:
109
- - - ~>
96
+ - - ">="
110
97
  - !ruby/object:Gem::Version
111
- version: 0.2.0
98
+ version: '0'
112
99
  description: Simple DCI
113
100
  email:
114
101
  - ps@neopoly.de
@@ -118,9 +105,9 @@ executables: []
118
105
  extensions: []
119
106
  extra_rdoc_files: []
120
107
  files:
121
- - .gitignore
122
- - .simplecov
123
- - .travis.yml
108
+ - ".gitignore"
109
+ - ".simplecov"
110
+ - ".travis.yml"
124
111
  - Gemfile
125
112
  - LICENSE
126
113
  - README.md
@@ -142,33 +129,26 @@ files:
142
129
  - test/role_test.rb
143
130
  homepage: https://github.com/neopoly/neo-dci
144
131
  licenses: []
132
+ metadata: {}
145
133
  post_install_message:
146
134
  rdoc_options: []
147
135
  require_paths:
148
136
  - lib
149
137
  required_ruby_version: !ruby/object:Gem::Requirement
150
- none: false
151
138
  requirements:
152
- - - ! '>='
139
+ - - ">="
153
140
  - !ruby/object:Gem::Version
154
141
  version: '0'
155
- segments:
156
- - 0
157
- hash: 4234988992783418766
158
142
  required_rubygems_version: !ruby/object:Gem::Requirement
159
- none: false
160
143
  requirements:
161
- - - ! '>='
144
+ - - ">="
162
145
  - !ruby/object:Gem::Version
163
146
  version: '0'
164
- segments:
165
- - 0
166
- hash: 4234988992783418766
167
147
  requirements: []
168
148
  rubyforge_project:
169
- rubygems_version: 1.8.24
149
+ rubygems_version: 2.2.2
170
150
  signing_key:
171
- specification_version: 3
151
+ specification_version: 4
172
152
  summary: Includes Data, Roles and Context.
173
153
  test_files:
174
154
  - test/context_test.rb