Module: Ronin::UI::Output::Helpers
- Included in:
- Shell
- Defined in:
- lib/ronin/ui/output/helpers.rb
Overview
Helper methods for printing output.
Instance Method Summary collapse
-
#format_message(message) ⇒ String
protected
private
Formats a message to be printed.
-
#print_debug(*message) ⇒ Boolean
Prints a
debug
message. -
#print_error(*message) ⇒ Boolean
Prints an
error
message. -
#print_info(*message) ⇒ Boolean
Prints an
info
message. -
#print_warning(*message) ⇒ Boolean
Prints a
warning
message. -
#printf(format, *data) ⇒ nil
Prints formatted data.
-
#putc(data) ⇒ String, Integer
Prints a character.
-
#puts(*messages) ⇒ Object
Prints one or more messages.
-
#write(data) ⇒ Integer?
Writes data unless output has been silenced.
Instance Method Details
#format_message(message) ⇒ String (protected)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Formats a message to be printed.
238 239 240 241 242 243 244 |
# File 'lib/ronin/ui/output/helpers.rb', line 238 def () if .length == 1 [0] else [0] % [1..-1] end end |
#print_debug(*message) ⇒ Boolean
Prints a debug
message.
158 159 160 161 162 163 164 165 |
# File 'lib/ronin/ui/output/helpers.rb', line 158 def print_debug(*) if (Output.verbose? && !(Output.silent?)) Output.handler.print_debug(()) return true end return false end |
#print_error(*message) ⇒ Boolean
Prints an error
message.
214 215 216 217 218 219 220 221 |
# File 'lib/ronin/ui/output/helpers.rb', line 214 def print_error(*) unless Output.silent? Output.handler.print_error(()) return true end return false end |
#print_info(*message) ⇒ Boolean
Prints an info
message.
133 134 135 136 137 138 139 140 |
# File 'lib/ronin/ui/output/helpers.rb', line 133 def print_info(*) unless Output.silent? Output.handler.print_info(()) return true end return false end |
#print_warning(*message) ⇒ Boolean
Prints a warning
message.
186 187 188 189 190 191 192 193 |
# File 'lib/ronin/ui/output/helpers.rb', line 186 def print_warning(*) if (Output.verbose? && !(Output.silent?)) Output.handler.print_warning(()) return true end return false end |
#printf(format, *data) ⇒ nil
Prints formatted data.
109 110 111 112 |
# File 'lib/ronin/ui/output/helpers.rb', line 109 def printf(format,*data) write(format % data) return nil end |
#putc(data) ⇒ String, Integer
Prints a character.
64 65 66 67 68 69 |
# File 'lib/ronin/ui/output/helpers.rb', line 64 def putc(data) char = data.chr if data.kind_of?(Integer) write(data) return data end |