Class: ColorDebugMessages::ColorDebugMsg
- Inherits:
-
Object
- Object
- ColorDebugMessages::ColorDebugMsg
- Includes:
- Term::ANSIColor
- Defined in:
- lib/color_debug_messages.rb
Overview
:nodoc:all
Instance Attribute Summary collapse
-
#calling_method_name ⇒ Object
readonly
Returns the value of attribute calling_method_name.
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#mark ⇒ Object
readonly
Returns the value of attribute mark.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
Instance Method Summary collapse
-
#initialize(msg, prefix = nil, mark = nil, color = nil) ⇒ ColorDebugMsg
constructor
A new instance of ColorDebugMsg.
- #to_s ⇒ Object
Constructor Details
#initialize(msg, prefix = nil, mark = nil, color = nil) ⇒ ColorDebugMsg
Returns a new instance of ColorDebugMsg.
76 77 78 79 80 81 |
# File 'lib/color_debug_messages.rb', line 76 def initialize(msg, prefix=nil, mark=nil, color=nil) @color = color @mark = mark @prefix = prefix @msg = msg end |
Instance Attribute Details
#calling_method_name ⇒ Object (readonly)
Returns the value of attribute calling_method_name.
74 75 76 |
# File 'lib/color_debug_messages.rb', line 74 def calling_method_name @calling_method_name end |
#color ⇒ Object (readonly)
Returns the value of attribute color.
74 75 76 |
# File 'lib/color_debug_messages.rb', line 74 def color @color end |
#mark ⇒ Object (readonly)
Returns the value of attribute mark.
74 75 76 |
# File 'lib/color_debug_messages.rb', line 74 def mark @mark end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
74 75 76 |
# File 'lib/color_debug_messages.rb', line 74 def msg @msg end |
Instance Method Details
#to_s ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/color_debug_messages.rb', line 83 def to_s str = '' if @prefix if @color str += send @color, bold('[') str += send @color, @prefix str += send @color, bold('] ') else str += "[#{@prefix}] " end end if @mark mark_str = @mark + @mark + '> ' if @color str += send @color, bold(mark_str) else str += mark_str end end str += reset if @color str += @msg end |