Class: I18nJSON::CLI::UI
- Inherits:
-
Object
- Object
- I18nJSON::CLI::UI
- Defined in:
- lib/i18n-json/cli/ui.rb
Instance Method Summary collapse
- #exit_with(*message) ⇒ Object
- #fail_with(*message) ⇒ Object
-
#initialize(stdout:, stderr:) ⇒ UI
constructor
A new instance of UI.
- #stderr_print(*message) ⇒ Object
- #stdout_print(*message) ⇒ Object
Constructor Details
#initialize(stdout:, stderr:) ⇒ UI
Returns a new instance of UI.
6 7 8 9 |
# File 'lib/i18n-json/cli/ui.rb', line 6 def initialize(stdout:, stderr:) @stdout = stdout @stderr = stderr end |
Instance Method Details
#exit_with(*message) ⇒ Object
24 25 26 27 |
# File 'lib/i18n-json/cli/ui.rb', line 24 def exit_with(*) stdout_print() exit(0) end |
#fail_with(*message) ⇒ Object
19 20 21 22 |
# File 'lib/i18n-json/cli/ui.rb', line 19 def fail_with(*) stderr_print() exit(1) end |
#stderr_print(*message) ⇒ Object
15 16 17 |
# File 'lib/i18n-json/cli/ui.rb', line 15 def stderr_print(*) @stderr << "#{.join(' ')}\n" end |
#stdout_print(*message) ⇒ Object
11 12 13 |
# File 'lib/i18n-json/cli/ui.rb', line 11 def stdout_print(*) @stdout << "#{.join(' ')}\n" end |