Class: FluentCommandBuilder::DefaultVersionDetector
- Inherits:
-
Object
- Object
- FluentCommandBuilder::DefaultVersionDetector
- Defined in:
- lib/fluent_command_builder/version_detectors/default_version_detector.rb
Instance Attribute Summary collapse
-
#path_finder ⇒ Object
Returns the value of attribute path_finder.
Instance Method Summary collapse
-
#initialize(command_name) ⇒ DefaultVersionDetector
constructor
A new instance of DefaultVersionDetector.
- #version(path = nil) ⇒ Object
Constructor Details
#initialize(command_name) ⇒ DefaultVersionDetector
Returns a new instance of DefaultVersionDetector.
10 11 12 13 14 |
# File 'lib/fluent_command_builder/version_detectors/default_version_detector.rb', line 10 def initialize(command_name) @command_name = command_name @command_args = %w(--version -version /version --help -help /help version help) @path_finder = FluentCommandBuilder.path_finder end |
Instance Attribute Details
#path_finder ⇒ Object
Returns the value of attribute path_finder.
8 9 10 |
# File 'lib/fluent_command_builder/version_detectors/default_version_detector.rb', line 8 def path_finder @path_finder end |
Instance Method Details
#version(path = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/fluent_command_builder/version_detectors/default_version_detector.rb', line 16 def version(path=nil) path ||= @path_finder.find_path @command_name return unless path && File.exist?(path) @command_args.each do |command_arg| version = try_get_version command_arg return version if version end try_get_version end |