proxylocal 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/lib/client.rb +12 -10
  3. data/proxylocal.gemspec +2 -2
  4. metadata +4 -4
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('proxylocal', '0.0.3') do |p|
5
+ Echoe.new('proxylocal', '0.0.4') do |p|
6
6
  p.description = 'http://proxylocal.com/'
7
7
  p.url = 'http://proxylocal.com/'
8
8
  p.author = 'Just Lest'
@@ -32,25 +32,27 @@ module ProxyLocal
32
32
  EventMachine::connect(options[:server_host], options[:server_port], self) do |c|
33
33
  c.instance_eval do
34
34
  @options = options
35
- send_object(:options => @options)
35
+ send_object(BERT::Tuple[:options, @options])
36
36
  end
37
37
  end
38
38
  end
39
39
  end
40
40
 
41
- def receive_object(obj)
42
- if obj.has_key?(:message)
43
- puts obj[:message]
44
- end
45
-
46
- EventMachine.stop_event_loop if obj[:halt]
41
+ def receive_object(message)
42
+ message = [message] unless message.is_a?(Array)
47
43
 
48
- if obj.has_key?(:uuid)
44
+ case message[0]
45
+ when :message
46
+ puts message[1]
47
+ when :halt
48
+ EventMachine.stop_event_loop
49
+ when :request
50
+ _, uuid, request = message
49
51
  EventMachine::connect('127.0.0.1', @options[:local_port], ClientProxy) do |connection|
50
52
  connection.callback do |data|
51
- send_object(:uuid => obj[:uuid], :response => data)
53
+ send_object(BERT::Tuple[:response, uuid, data])
52
54
  end
53
- connection.send_data(obj[:request])
55
+ connection.send_data(request)
54
56
  end
55
57
  end
56
58
  end
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{proxylocal}
5
- s.version = "0.0.3"
5
+ s.version = "0.0.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Just Lest"]
9
- s.date = %q{2010-11-09}
9
+ s.date = %q{2010-11-12}
10
10
  s.default_executable = %q{proxylocal}
11
11
  s.description = %q{http://proxylocal.com/}
12
12
  s.email = %q{just.lest@gmail.com}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxylocal
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Just Lest
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-09 00:00:00 +02:00
18
+ date: 2010-11-12 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency