Module: Fastbeans
- Defined in:
- lib/fastbeans.rb,
lib/fastbeans/client.rb,
lib/fastbeans/errors.rb,
lib/fastbeans/request.rb,
lib/fastbeans/version.rb,
lib/fastbeans/response.rb,
lib/fastbeans/connection.rb
Defined Under Namespace
Classes: AutogeneratedException, Client, Connection, RPCException, RemoteCallFailed, RemoteConnectionDead, RemoteConnectionFailed, RemoteException, Request, Response, ResponseReadTimeout, ResponseSignatureMismatch
Constant Summary
collapse
- VERSION =
"0.4.3"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.debug_mode ⇒ Object
8
9
10
|
# File 'lib/fastbeans.rb', line 8
def debug_mode
@debug_mode
end
|
Class Method Details
.benchmark(str, &blk) ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'lib/fastbeans.rb', line 28
def benchmark(str, &blk)
debug(str)
t1 = Time.now
blk.call
ensure
t2 = Time.now
debug("Time spent: #{t2-t1}s") if t1
end
|
.debug(str_or_exc) ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/fastbeans.rb', line 10
def debug(str_or_exc)
case str_or_exc
when String
STDERR.puts("[#{Time.now}] #{str_or_exc}") if self.debug_mode
when Exception
debug("Exception: #{str_or_exc.message}\n#{str_or_exc.backtrace.join("\n")}")
end
end
|
.error(str_or_exc) ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/fastbeans.rb', line 19
def error(str_or_exc)
case str_or_exc
when String
STDERR.puts("[#{Time.now}] #{str_or_exc}")
when Exception
error("Exception: #{str_or_exc.message}\n#{str_or_exc.backtrace.join("\n")}")
end
end
|
.exception(classname) ⇒ Object