Class: Toys::StandardMiddleware::ShowRootVersion
- Inherits:
-
Object
- Object
- Toys::StandardMiddleware::ShowRootVersion
- Defined in:
- lib/toys/standard_middleware/show_root_version.rb
Overview
A middleware that displays a version string for the root tool if the
--version
flag is given.
Constant Summary collapse
- DEFAULT_VERSION_FLAGS =
Default version flags
["--version"].freeze
- DEFAULT_VERSION_FLAG_DESC =
Default description for the version flags
"Display the version"
- SHOW_VERSION_KEY =
Key set when the version flag is present
Object.new.freeze
Instance Method Summary collapse
-
#initialize(version_string: nil, version_flags: DEFAULT_VERSION_FLAGS, version_flag_desc: DEFAULT_VERSION_FLAG_DESC, stream: $stdout) ⇒ ShowRootVersion
constructor
Create a ShowVersion middleware.
Constructor Details
#initialize(version_string: nil, version_flags: DEFAULT_VERSION_FLAGS, version_flag_desc: DEFAULT_VERSION_FLAG_DESC, stream: $stdout) ⇒ ShowRootVersion
Create a ShowVersion middleware
37 38 39 40 41 42 43 44 45 |
# File 'lib/toys/standard_middleware/show_root_version.rb', line 37 def initialize(version_string: nil, version_flags: DEFAULT_VERSION_FLAGS, version_flag_desc: DEFAULT_VERSION_FLAG_DESC, stream: $stdout) @version_string = version_string @version_flags = version_flags @version_flag_desc = version_flag_desc @output = stream end |