Module: RDF::Tabular::Utils
- Included in:
- Metadata, Metadata::DebugContext, Reader
- Defined in:
- lib/rdf/tabular/utils.rb
Class Method Summary collapse
-
.debug(*args) ⇒ Object
Add debug event to debug array, if specified.
Instance Method Summary collapse
-
#depth { ... } ⇒ Object
Increase depth around a method invocation.
Class Method Details
.debug(*args) ⇒ Object
Add debug event to debug array, if specified
param [String] message
yieldreturn [String] appended to message, to allow for lazy-evaulation of message
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rdf/tabular/utils.rb', line 7 def debug(*args) = args.last.is_a?(Hash) ? args.pop : {} return unless [:debug] || @options[:debug] || RDF::Tabular.debug? depth = [:depth] || @options[:depth] d_str = depth > 100 ? ' ' * 100 + '+' : ' ' * depth list = args list << yield if block_given? = d_str + (list.empty? ? "" : list.join(": ")) [:debug] << if [:debug].is_a?(Array) @options[:debug] << if @options[:debug].is_a?(Array) $stderr.puts() if RDF::Tabular.debug? || @options[:debug] == TrueClass end |
Instance Method Details
#depth { ... } ⇒ Object
Increase depth around a method invocation
26 27 28 29 30 31 |
# File 'lib/rdf/tabular/utils.rb', line 26 def depth @options[:depth] += 1 ret = yield @options[:depth] -= 1 ret end |