Class: Dicey::CLI::Blender Private
- Inherits:
-
Object
- Object
- Dicey::CLI::Blender
- Defined in:
- lib/dicey/cli/blender.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Slice and dice everything in the Dicey module to produce a useful result. This is the entry point for the CLI.
Constant Summary collapse
- OPTION_TRANSFORMATIONS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
How to transform option values from command-line arguments to internally significant objects.
{ mode: lambda(&:to_sym), result: lambda(&:to_sym), format: { "list" => Formatters::ListFormatter.new, "gnuplot" => Formatters::GnuplotFormatter.new, "yaml" => Formatters::YAMLFormatter.new, "json" => Formatters::JSONFormatter.new, "null" => Formatters::NullFormatter.new, }.freeze, }.freeze
- RUNNERS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
What to run for every mode. Every runner must respond to ‘call(arguments, **options)` and return
true,falseor a String. { roll: Roller.new, distribution: CLI::CalculatorRunner.new, test: CLI::CalculatorTestRunner.new, }.freeze
Instance Method Summary collapse
-
#call(argv = ARGV) ⇒ Boolean
private
Run the program, blending everything together.
Instance Method Details
#call(argv = ARGV) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Run the program, blending everything together.
46 47 48 49 50 51 52 |
# File 'lib/dicey/cli/blender.rb', line 46 def call(argv = ARGV) , arguments = (argv) require_optional_libraries() return_value = RUNNERS[.delete(:mode)].call(arguments, **) print return_value if return_value.is_a?(String) !!return_value end |