Class: GithubCLI::UI
- Inherits:
-
Object
- Object
- GithubCLI::UI
- Defined in:
- lib/github_cli/ui.rb
Instance Attribute Summary collapse
-
#shell ⇒ Object
writeonly
Sets the attribute shell.
Instance Method Summary collapse
- #confirm(message, newline = nil) ⇒ Object
- #debug(message, newline = nil) ⇒ Object
- #debug! ⇒ Object
- #error(message, newline = nil) ⇒ Object
- #info(message, newline = nil) ⇒ Object
-
#initialize(shell) ⇒ UI
constructor
A new instance of UI.
- #print_table(table, options = {}) ⇒ Object
- #print_wrapped(message, options = {}) ⇒ Object
- #quite! ⇒ Object
- #terminal_width ⇒ Object
- #warn(message, newline = nil) ⇒ Object
Constructor Details
#initialize(shell) ⇒ UI
Returns a new instance of UI.
7 8 9 10 11 |
# File 'lib/github_cli/ui.rb', line 7 def initialize(shell) @shell = shell @quite = false @debug = ENV['DEBUG'] end |
Instance Attribute Details
#shell=(value) ⇒ Object (writeonly)
Sets the attribute shell
5 6 7 |
# File 'lib/github_cli/ui.rb', line 5 def shell=(value) @shell = value end |
Instance Method Details
#confirm(message, newline = nil) ⇒ Object
13 14 15 |
# File 'lib/github_cli/ui.rb', line 13 def confirm(, newline=nil) @shell.say , :green, newline end |
#debug(message, newline = nil) ⇒ Object
29 30 31 |
# File 'lib/github_cli/ui.rb', line 29 def debug(, newline=nil) @shell.say , nil, newline end |
#debug! ⇒ Object
37 38 39 |
# File 'lib/github_cli/ui.rb', line 37 def debug! @debug = true end |
#error(message, newline = nil) ⇒ Object
25 26 27 |
# File 'lib/github_cli/ui.rb', line 25 def error(, newline=nil) @shell.say , :red, newline end |
#info(message, newline = nil) ⇒ Object
17 18 19 |
# File 'lib/github_cli/ui.rb', line 17 def info(, newline=nil) @shell.say , nil, newline end |
#print_table(table, options = {}) ⇒ Object
41 42 43 |
# File 'lib/github_cli/ui.rb', line 41 def print_table(table, ={}) @shell.print_table table, end |
#print_wrapped(message, options = {}) ⇒ Object
45 46 47 |
# File 'lib/github_cli/ui.rb', line 45 def print_wrapped(, ={}) @shell.print_wrapped , end |
#quite! ⇒ Object
33 34 35 |
# File 'lib/github_cli/ui.rb', line 33 def quite! @quite = true end |
#terminal_width ⇒ Object
49 50 51 |
# File 'lib/github_cli/ui.rb', line 49 def terminal_width @shell.terminal_width end |
#warn(message, newline = nil) ⇒ Object
21 22 23 |
# File 'lib/github_cli/ui.rb', line 21 def warn(, newline=nil) @shell.say , :yellow, newline end |