neo-dci 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,12 @@
1
+ module Neo
2
+ module DCI
3
+ end
4
+ end
5
+
1
6
  require 'neo/dci/version'
2
-
3
7
  require 'neo/dci/data'
4
8
  require 'neo/dci/role'
5
9
  require 'neo/dci/context'
10
+ require 'neo/dci/context_result'
6
11
 
7
12
  require 'neo/dci/task_loader' if defined?(::Rails::Railtie)
@@ -1,5 +1,3 @@
1
- require 'on'
2
-
3
1
  module Neo
4
2
  module DCI
5
3
  class Context
@@ -17,13 +15,18 @@ module Neo
17
15
 
18
16
  def self.call(*args, &block)
19
17
  context = new(*args)
20
- context.callback = On.new(*callbacks, &block)
18
+ context.callback = result_class.new(*callbacks, &block)
21
19
  context.call
22
20
  raise NoCallbackCalled, callbacks unless context.callback.callback
23
21
  rescue NotImplementedError
24
22
  raise
25
23
  end
26
24
 
25
+ def self.result_class(klass = :reader)
26
+ @result_class = klass unless klass == :reader
27
+ @result_class || ContextResult
28
+ end
29
+
27
30
  def call
28
31
  raise NotImplementedError
29
32
  end
@@ -0,0 +1,9 @@
1
+ require 'on'
2
+
3
+ module Neo
4
+ module DCI
5
+ # Result emitted by the Context.
6
+ class ContextResult < On
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  module Neo
2
2
  module DCI
3
- VERSION = "0.3.0"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo-dci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-11-29 00:00:00.000000000 Z
14
+ date: 2012-12-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -128,6 +128,7 @@ files:
128
128
  - lib/neo-dci.rb
129
129
  - lib/neo/dci.rb
130
130
  - lib/neo/dci/context.rb
131
+ - lib/neo/dci/context_result.rb
131
132
  - lib/neo/dci/data.rb
132
133
  - lib/neo/dci/role.rb
133
134
  - lib/neo/dci/task_loader.rb
@@ -153,7 +154,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
154
  version: '0'
154
155
  segments:
155
156
  - 0
156
- hash: -3362418473646590166
157
+ hash: 4234988992783418766
157
158
  required_rubygems_version: !ruby/object:Gem::Requirement
158
159
  none: false
159
160
  requirements:
@@ -162,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
162
163
  version: '0'
163
164
  segments:
164
165
  - 0
165
- hash: -3362418473646590166
166
+ hash: 4234988992783418766
166
167
  requirements: []
167
168
  rubyforge_project:
168
169
  rubygems_version: 1.8.24