Class: FluentCommandBuilder::CommandBuilderConfig
- Inherits:
-
Object
- Object
- FluentCommandBuilder::CommandBuilderConfig
- Defined in:
- lib/fluent_command_builder/internal/command_builder_config.rb
Instance Attribute Summary collapse
-
#command_name ⇒ Object
Returns the value of attribute command_name.
-
#path ⇒ Object
Returns the value of attribute path.
-
#path_validation_level ⇒ Object
Returns the value of attribute path_validation_level.
-
#path_validator ⇒ Object
Returns the value of attribute path_validator.
-
#version ⇒ Object
Returns the value of attribute version.
-
#version_validation_level ⇒ Object
Returns the value of attribute version_validation_level.
-
#version_validator ⇒ Object
Returns the value of attribute version_validator.
Instance Method Summary collapse
- #executable ⇒ Object
-
#initialize(command_name, version = nil) ⇒ CommandBuilderConfig
constructor
A new instance of CommandBuilderConfig.
- #validate_path ⇒ Object
- #validate_version ⇒ Object
Constructor Details
#initialize(command_name, version = nil) ⇒ CommandBuilderConfig
Returns a new instance of CommandBuilderConfig.
13 14 15 16 17 18 19 20 21 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 13 def initialize(command_name, version=nil) @path = nil @command_name = command_name @version = version @path_validation_level = :fatal @version_validation_level = :fatal @path_validator = PathValidator.new self @version_validator = nil end |
Instance Attribute Details
#command_name ⇒ Object
Returns the value of attribute command_name.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def command_name @command_name end |
#path ⇒ Object
Returns the value of attribute path.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def path @path end |
#path_validation_level ⇒ Object
Returns the value of attribute path_validation_level.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def path_validation_level @path_validation_level end |
#path_validator ⇒ Object
Returns the value of attribute path_validator.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def path_validator @path_validator end |
#version ⇒ Object
Returns the value of attribute version.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def version @version end |
#version_validation_level ⇒ Object
Returns the value of attribute version_validation_level.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def version_validation_level @version_validation_level end |
#version_validator ⇒ Object
Returns the value of attribute version_validator.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def version_validator @version_validator end |
Instance Method Details
#executable ⇒ Object
34 35 36 37 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 34 def executable p = Path.new @path.to_s, @command_name p.normalised_path end |
#validate_path ⇒ Object
23 24 25 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 23 def validate_path @path_validator.validate end |
#validate_version ⇒ Object
27 28 29 30 31 32 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 27 def validate_version return unless @version v = @version_validator || VersionValidator.new(@command_name) { |path| GetVersion[path] } p = Path.new @path v.validate @version, p.evaluated_path end |