Module: Croupier
- Defined in:
- lib/croupier.rb,
lib/croupier/version.rb,
lib/croupier/exceptions.rb,
lib/croupier/distribution.rb,
lib/croupier/distributions.rb,
lib/croupier/cli/application.rb,
lib/croupier/distributions/cauchy.rb,
lib/croupier/distributions/normal.rb,
lib/croupier/distributions/poisson.rb,
lib/croupier/distributions/uniform.rb,
lib/croupier/distributions/binomial.rb,
lib/croupier/distributions/bernoulli.rb,
lib/croupier/distributions/geometric.rb,
lib/croupier/distributions/nbinomial.rb,
lib/croupier/distributions/triangular.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
- VERSION =
"1.4.0"
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
21 22 23 |
# File 'lib/croupier.rb', line 21 def application @application ||= ::Croupier::CLI::Application.new end |
.application=(app) ⇒ Object
Set the current Croupier application object.
26 27 28 |
# File 'lib/croupier.rb', line 26 def application=(app) @application = app end |
.clear_line! ⇒ Object
Clear current console line
55 56 57 |
# File 'lib/croupier.rb', line 55 def clear_line! self.write "\r" end |
.error_message(msg) ⇒ Object
Writes message to the error output
43 44 45 46 |
# File 'lib/croupier.rb', line 43 def (msg) STDERR.puts msg STDERR.flush end |
.message(msg) ⇒ Object
Writes message to the standard output
37 38 39 40 |
# File 'lib/croupier.rb', line 37 def (msg) STDOUT.puts msg STDOUT.flush end |
.stop(msg = "Error: Croupier finished.") ⇒ Object
Stops the execution of the Croupier application.
31 32 33 34 |
# File 'lib/croupier.rb', line 31 def stop(msg = "Error: Croupier finished.") self. msg exit(false) end |