Module: RDF::Normalize::Utils
- Included in:
- Carroll2001, URDNA2015, RDF::Normalize::URDNA2015::NormalizationState
- Defined in:
- lib/rdf/normalize/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]
yieldreturn [String] appended to , to allow for lazy-evaulation of
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rdf/normalize/utils.rb', line 7 def debug(*args) = args.last.is_a?(Hash) ? args.pop : {} return unless [:debug] || [:debug] depth = [:depth] || [: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) [:debug] << if [:debug].is_a?(Array) $stderr.puts() if [:debug] == TrueClass end |
Instance Method Details
#depth { ... } ⇒ Object
Increase depth around a method invocation
26 27 28 29 30 31 |
# File 'lib/rdf/normalize/utils.rb', line 26 def depth [:depth] += 1 ret = yield [:depth] -= 1 ret end |