rdf-tabular 0.3.0 → 0.4.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,33 +0,0 @@
1
- module RDF::Tabular
2
- module Utils
3
- # Add debug event to debug array, if specified
4
- #
5
- # param [String] message
6
- # yieldreturn [String] appended to message, to allow for lazy-evaulation of message
7
- def debug(*args)
8
- options = args.last.is_a?(Hash) ? args.pop : {}
9
- return unless options[:debug] || @options[:debug] || RDF::Tabular.debug?
10
- depth = options[:depth] || @options[:depth]
11
- d_str = depth > 100 ? ' ' * 100 + '+' : ' ' * depth
12
- list = args
13
- list << yield if block_given?
14
- message = d_str + (list.empty? ? "" : list.join(": "))
15
- options[:debug] << message if options[:debug].is_a?(Array)
16
- @options[:debug] << message if @options[:debug].is_a?(Array)
17
- $stderr.puts(message) if RDF::Tabular.debug? || @options[:debug] == TrueClass
18
- end
19
- module_function :debug
20
-
21
- # Increase depth around a method invocation
22
- # @yield
23
- # Yields with no arguments
24
- # @yieldreturn [Object] returns the result of yielding
25
- # @return [Object]
26
- def depth
27
- @options[:depth] += 1
28
- ret = yield
29
- @options[:depth] -= 1
30
- ret
31
- end
32
- end
33
- end