senotrusov-ruby-daemonic-threads 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -280,6 +280,7 @@ class DaemonicThreads::HTTP::HttpRequest
|
|
280
280
|
# Based on ActionController::Base
|
281
281
|
#
|
282
282
|
# response object||string [, options]
|
283
|
+
# response :object => object||string [, options] -- Then response is hash
|
283
284
|
# response :xml => object||string [, options]
|
284
285
|
# response :json => object||string [, options]
|
285
286
|
# response :text => string [, options]
|
@@ -303,6 +304,8 @@ class DaemonicThreads::HTTP::HttpRequest
|
|
303
304
|
format = Mime::XML
|
304
305
|
elsif data = options[:json]
|
305
306
|
format = Mime::JSON
|
307
|
+
elsif data = options[:object]
|
308
|
+
format = requested_format || Mime::XML
|
306
309
|
elsif data = options[:text]
|
307
310
|
data = data.to_s
|
308
311
|
format = Mime::HTML
|
@@ -129,19 +129,19 @@ module DaemonicThreads::Prototype
|
|
129
129
|
|
130
130
|
|
131
131
|
# Можно запускать из initialize_daemon или из любого треда
|
132
|
-
def spawn_thread(thread_name, *args)
|
132
|
+
def spawn_thread(thread_name, *args, &block)
|
133
133
|
@creatures_mutex.synchronize do
|
134
134
|
raise(DaemonicThreads::MustTerminatedState, "Unable to spawn new threads after stop() is called") if @must_terminate
|
135
135
|
|
136
136
|
thread_title = "#{self.class}#thread:`#{thread_name}' @name:`#{@name}'"
|
137
137
|
|
138
|
-
@threads.add(thread = Thread.new { execute_thread(thread_name, thread_title, args) } )
|
138
|
+
@threads.add(thread = Thread.new { execute_thread(thread_name, thread_title, *args, &block) } )
|
139
139
|
|
140
140
|
return thread
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
|
-
def execute_thread(thread_name, thread_title, args)
|
144
|
+
def execute_thread(thread_name, thread_title, *args)
|
145
145
|
|
146
146
|
panic_on_exception(thread_title) do
|
147
147
|
Thread.current[:title] = thread_title
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: senotrusov-ruby-daemonic-threads
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stanislav Senotrusov
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-30 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|