Class: PrettyIRB::Formatter
- Inherits:
-
Object
- Object
- PrettyIRB::Formatter
- Defined in:
- lib/pretty_irb/formatter.rb
Class Method Summary collapse
-
.format_error(error_message) ⇒ Object
Format error messages with pretty colors.
-
.format_output(output) ⇒ Object
Pretty print output with colors.
-
.format_success(message) ⇒ Object
Format success messages.
-
.format_warning(message) ⇒ Object
Format warning messages.
Class Method Details
.format_error(error_message) ⇒ Object
Format error messages with pretty colors
29 30 31 32 33 |
# File 'lib/pretty_irb/formatter.rb', line 29 def format_error() .red.bold rescue end |
.format_output(output) ⇒ Object
Pretty print output with colors
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pretty_irb/formatter.rb', line 7 def format_output(output) case output when String output.light_blue when Numeric output.to_s.light_green when TrueClass, FalseClass output.to_s.light_cyan when NilClass "nil".light_black when Array format_array(output) when Hash format_hash(output) else output.inspect.light_yellow end rescue output.to_s end |
.format_success(message) ⇒ Object
Format success messages
36 37 38 39 40 |
# File 'lib/pretty_irb/formatter.rb', line 36 def format_success() .green rescue end |
.format_warning(message) ⇒ Object
Format warning messages
43 44 45 46 47 |
# File 'lib/pretty_irb/formatter.rb', line 43 def format_warning() .yellow rescue end |