Module: Parlour::Debugging
- Extended by:
- T::Sig
- Defined in:
- lib/parlour/debugging.rb
Overview
Contains methods to enable debugging facilities for Parlour.
Defined Under Namespace
Classes: Tree
Class Method Summary collapse
- .debug_mode=(value) ⇒ Object
- .debug_mode? ⇒ Boolean
- .debug_puts(object, message) ⇒ Object
- .name_for_debug_caller(object) ⇒ Object
Class Method Details
.debug_mode=(value) ⇒ Object
16 17 18 |
# File 'lib/parlour/debugging.rb', line 16 def self.debug_mode=(value) @debug_mode = value end |
.debug_mode? ⇒ Boolean
24 25 26 |
# File 'lib/parlour/debugging.rb', line 24 def self.debug_mode? @debug_mode end |
.debug_puts(object, message) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/parlour/debugging.rb', line 36 def self.debug_puts(object, ) return unless debug_mode? name = Rainbow("#{name_for_debug_caller(object)}: ").magenta.bright.bold prefix = Rainbow("Parlour debug: ").blue.bright.bold puts prefix + name + end |
.name_for_debug_caller(object) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/parlour/debugging.rb', line 50 def self.name_for_debug_caller(object) case object when ConflictResolver "conflict resolver" when RbiGenerator "RBI generator" else if ((object < Plugin) rescue false) return "plugin #{object.name}" end object.class.name end end |