Module: Croupier
- Defined in:
- lib/croupier.rb,
lib/croupier/exceptions.rb,
lib/croupier/distribution.rb,
lib/croupier/cli/application.rb,
lib/croupier/distributions/normal.rb,
lib/croupier/distributions/uniform.rb,
lib/croupier/distributions/exponential.rb
Overview
The module defines a Croupier::CLI::Application and interacts with the user output console.
Defined Under Namespace
Modules: CLI, Distributions Classes: Distribution, Error, InputParamsError, InvalidOptionError
Constant Summary collapse
- STDERR =
$stderr
- STDOUT =
$stdout
Class Method Summary collapse
-
.application ⇒ Object
Current Croupier Application.
-
.application=(app) ⇒ Object
Set the current Croupier application object.
-
.clear_line! ⇒ Object
Clear current console line.
-
.error_message(msg) ⇒ Object
Writes message to the error output.
-
.message(msg) ⇒ Object
Writes message to the standard output.
-
.stop(msg = "Error: Croupier finished.") ⇒ Object
Stops the execution of the Croupier application.
-
.trap_interrupt ⇒ Object
Trap SIGINT signal.
-
.write(str) ⇒ Object
Writes to the standard output.
Class Method Details
.application ⇒ Object
Current Croupier Application
19 20 21 |
# File 'lib/croupier.rb', line 19 def application @application ||= ::Croupier::CLI::Application.new end |
.application=(app) ⇒ Object
Set the current Croupier application object.
24 25 26 |
# File 'lib/croupier.rb', line 24 def application=(app) @application = app end |
.clear_line! ⇒ Object
Clear current console line
53 54 55 |
# File 'lib/croupier.rb', line 53 def clear_line! self.write "\r" end |
.error_message(msg) ⇒ Object
Writes message to the error output
41 42 43 44 |
# File 'lib/croupier.rb', line 41 def (msg) STDERR.puts msg STDERR.flush end |
.message(msg) ⇒ Object
Writes message to the standard output
35 36 37 38 |
# File 'lib/croupier.rb', line 35 def (msg) STDOUT.puts msg STDOUT.flush end |
.stop(msg = "Error: Croupier finished.") ⇒ Object
Stops the execution of the Croupier application.
29 30 31 32 |
# File 'lib/croupier.rb', line 29 def stop(msg = "Error: Croupier finished.") self. msg exit(false) end |