Class: Ruvi::Debug
Instance Attribute Summary collapse
-
#debug_symbols ⇒ Object
Returns the value of attribute debug_symbols.
Instance Method Summary collapse
- #dbg(dbg_sym, &block) ⇒ Object
-
#initialize ⇒ Debug
constructor
A new instance of Debug.
- #register_debug_buffer(buffer) ⇒ Object
Constructor Details
#initialize ⇒ Debug
Returns a new instance of Debug.
36 37 38 |
# File 'lib/debug.rb', line 36 def initialize @debug_symbols = [] end |
Instance Attribute Details
#debug_symbols ⇒ Object
Returns the value of attribute debug_symbols.
34 35 36 |
# File 'lib/debug.rb', line 34 def debug_symbols @debug_symbols end |
Instance Method Details
#dbg(dbg_sym, &block) ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/debug.rb', line 44 def dbg dbg_sym, &block return if !dbg_sym.nil? and @debug_symbols.empty? return if !dbg_sym.nil? and !(@debug_symbols.include? dbg_sym) str = block.call line = (str.is_a? String) ? str : str.inspect if $test_case puts line return end @debug_buffer.lines << BufferLine.new(line) end |
#register_debug_buffer(buffer) ⇒ Object
40 41 42 |
# File 'lib/debug.rb', line 40 def register_debug_buffer buffer @debug_buffer = buffer end |