Module: Swift::Playground::CLI::UI
- Extended by:
- SingleForwardable
- Defined in:
- lib/swift/playground/cli/ui.rb
Class Method Summary collapse
- .debug(message = nil, &block) ⇒ Object
- .error(message = nil, exception = nil) ⇒ Object
- .info(message = nil, &block) ⇒ Object
- .say(message = "\n") ⇒ Object
Class Method Details
.debug(message = nil, &block) ⇒ Object
59 60 61 62 63 64 65 66 |
# File 'lib/swift/playground/cli/ui.rb', line 59 def debug( = nil, &block) return if silence if show_debug = (, &block) stderr.puts blue() end end |
.error(message = nil, exception = nil) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/swift/playground/cli/ui.rb', line 47 def error( = nil, exception = nil) return if silence stderr.puts red() if exception && show_debug exception_details = ["Handled <#{exception.class}>:", exception., *exception.backtrace] stderr.puts red("\n" + exception_details.join("\n") + "\n") end end |
.info(message = nil, &block) ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/swift/playground/cli/ui.rb', line 68 def info( = nil, &block) return if silence if show_debug = (, &block) stderr.puts cyan() end end |
.say(message = "\n") ⇒ Object
41 42 43 44 45 |
# File 'lib/swift/playground/cli/ui.rb', line 41 def say( = "\n") return if silence terminal.say end |