jstp 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,8 +10,6 @@ require 'jstp/registry'
10
10
  require 'jstp/server'
11
11
  require 'jstp/event_machine'
12
12
 
13
- module JSTP
14
- class << self
15
- include API
16
- end
17
- end
13
+ class << self
14
+ include JSTP::API
15
+ end
@@ -1,9 +1,13 @@
1
1
  module JSTP
2
2
  module API
3
- def dispatch &block
4
- JSTP::Registry.instance.set block
3
+ def dispatch *args, &block
4
+ if args.empty? and block
5
+ JSTP::Registry.instance.set block
5
6
 
6
- ::EventMachine.run &JSTP::EventMachine
7
+ ::EventMachine.run &JSTP::EventMachine
8
+ else
9
+ Connector.instance.dispatch args.first
10
+ end
7
11
  end
8
12
  end
9
13
  end
@@ -1,3 +1,3 @@
1
1
  module Jstp
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -20,5 +20,21 @@ describe JSTP::API do
20
20
  o.dispatch &block
21
21
  end
22
22
  end
23
+
24
+ context 'an argument is passed' do
25
+ it 'should dispatch the message via the Connector' do
26
+ message = stub 'message'
27
+ JSTP::Connector.instance.should_receive(:dispatch)
28
+ .with message
29
+
30
+ o = Object.new
31
+ o.extend JSTP::API
32
+ o.dispatch message
33
+ end
34
+ end
35
+ end
36
+
37
+ describe '#port' do
38
+ it 'should configure the port number'
23
39
  end
24
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jstp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: