Method: Ing::Shell::Basic#say
- Defined in:
- lib/ing/shell.rb
#say(message = "", color = nil, force_new_line = (message.to_s !~ /( |\t)$/)) ⇒ Object
Say (print) something to the user. If the sentence ends with a whitespace or tab character, a new line is not appended (print + flush). Otherwise are passed straight to puts (behavior got from Highline).
Example
say(“I know you knew that.”)
85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/ing/shell.rb', line 85 def say(="", color=nil, force_new_line=(.to_s !~ /( |\t)$/)) = .to_s = set_color(, *color) if color spaces = " " * padding if force_new_line stdout.puts(spaces + ) else stdout.print(spaces + ) end stdout.flush end |