Module: Fastbeans
- Defined in:
- lib/fastbeans.rb,
lib/fastbeans/client.rb,
lib/fastbeans/errors.rb,
lib/fastbeans/version.rb,
lib/fastbeans/response.rb
Defined Under Namespace
Classes: AutogeneratedException, Client, Exception, RemoteCallFailed, RemoteConnectionDead, RemoteConnectionFailed, RemoteException, Response
Constant Summary
collapse
- VERSION =
"0.2.1"
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
19
20
21
22
23
24
25
26
|
# File 'lib/fastbeans.rb', line 19
def benchmark(str, &blk)
debug(str)
t1 = Time.now
blk.call
ensure
t2 = Time.now
debug("Time spent: #{t2-t1}s")
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
|
.exception(classname) ⇒ Object