minep-request 0.0.2 → 0.0.3
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.
- data/bin/mine-request +1 -0
- data/lib/minep/connection.rb +3 -2
- data/lib/minep/minep.rb +3 -1
- metadata +2 -2
data/bin/mine-request
CHANGED
data/lib/minep/connection.rb
CHANGED
@@ -4,9 +4,10 @@ module MINEP
|
|
4
4
|
# Initialize the object
|
5
5
|
#
|
6
6
|
# @param [Hash] request is the request, The text request is built from this
|
7
|
-
def initialize request
|
7
|
+
def initialize request, closeLoop=false
|
8
8
|
super
|
9
9
|
@request = ["#{request[:header][:head]}\n"]
|
10
|
+
@closeLoop = closeLoop
|
10
11
|
request[:header].each do |key, value|
|
11
12
|
if key == :head
|
12
13
|
next
|
@@ -37,7 +38,7 @@ module MINEP
|
|
37
38
|
end
|
38
39
|
|
39
40
|
def unbind
|
40
|
-
EventMachine::stop_event_loop
|
41
|
+
EventMachine::stop_event_loop if @closeLoop
|
41
42
|
end
|
42
43
|
end
|
43
44
|
end
|
data/lib/minep/minep.rb
CHANGED
@@ -4,12 +4,14 @@ module MINEP
|
|
4
4
|
#
|
5
5
|
# @param [Symbol] type the request type, see main page for the requests list
|
6
6
|
# @param [Hash] opts stores the parameters of the request and host and port, see main page for the requests parameters
|
7
|
+
# @param [Bool] closeLoop define if the event loop has to be closed when unbinding
|
7
8
|
def self.send type, opts={}
|
8
9
|
request = {}
|
9
10
|
return false unless Utils.makeRequest request, type, opts
|
10
11
|
EM.run do
|
11
12
|
EM.connect(opts[:host] || "localhost",
|
12
|
-
opts[:port] || 8080, Connection, request
|
13
|
+
opts[:port] || 8080, Connection, request,
|
14
|
+
opts[:closeLoop])
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minep-request
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-11-
|
12
|
+
date: 2012-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: ! 'Allows to communicate with a MINE server.
|
15
15
|
|