Module: Jade::Debug
Constant Summary collapse
- MAX_DEPTH =
12
Instance Method Summary collapse
Instance Method Details
#log(label, value) ⇒ Object
7 8 9 10 |
# File 'lib/jade/debug.rb', line 7 def log(label, value) warn("#{label}: #{render(value)}") value end |
#render(value, depth = 0) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/jade/debug.rb', line 12 def render(value, depth = 0) return '…' if depth > MAX_DEPTH case value when ::String then value.inspect when ::Symbol then value.to_s when nil then 'Nothing' when true, false, ::Integer, ::Float then value.to_s when ::Array then render_list(value, depth) when ::Hash then render_record(value, depth) when ::Data then render_variant(value, depth) when ::Proc then '<function>' else value.inspect end end |